[
https://issues.apache.org/jira/browse/OFBIZ-13399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18078824#comment-18078824
]
ASF subversion and git services commented on OFBIZ-13399:
---------------------------------------------------------
Commit d80136120308907d72c0aafbc6b79781eb0db11f in ofbiz-framework's branch
refs/heads/trunk from Deepak Dixit
[ https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=d801361203 ]
Refactor Groovy EntityListIterator usage with auto-closeable handling… (#1167)
Improved : Updated Groovy files to use safer resource management
patterns for EntityListIterator (OFBIZ-13399)
- 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)