[ 
https://issues.apache.org/jira/browse/OFBIZ-13399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18078674#comment-18078674
 ] 

Deepak Dixit commented on OFBIZ-13399:
--------------------------------------

Improved : Updated Groovy files to use safer resource management patterns for 
EntityListIterator ([#1167|https://github.com/apache/ofbiz-framework/pull/1167])
 * Replaced manual iterator close handling with try-with-resources style 
implementations where applicable
 * Used Groovy withCloseable for automatic resource cleanup
 * Replaced EntityListIterator usage with EntityQuery.queryPagedList() where 
only partial/paged results were required
 * Removed unnecessary manual close() calls
 * Reduced risk of JDBC cursor and ResultSet resource leaks
 * Improved readability and aligned code with modern OFBiz best practices

Changes were applied to Groovy files; full regression testing has not yet been 
completed for all updated flows.

> Use try-with-resources for EntityListIterator
> ---------------------------------------------
>
>                 Key: OFBIZ-13399
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-13399
>             Project: OFBiz
>          Issue Type: New Feature
>            Reporter: Deepak Dixit
>            Assignee: Deepak Dixit
>            Priority: Major
>
> Replace manual handling of {{EntityListIterator}} with try-with-resources (or 
> Groovy {{{}withCloseable{}}}) to ensure proper resource management and avoid 
> potential resource leaks.
> Currently, iterators are being closed manually using {{close()}} or sometimes 
> not closed.
> This can lead to:
>  * Open JDBC {{{}ResultSet{}}}/cursor leaks
>  * Increased memory usage
>  * Connection/resource exhaustion under load



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to