[jira] [Commented] (OFBIZ-9385) EntityListIterator closed but not in case of exception

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OFBIZ-9385) EntityListIterator closed but not in case of exception

Nicolas Malin (Jira)

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

Jacques Le Roux commented on OFBIZ-9385:
----------------------------------------

There are few methods like FindServices.executeFind() or performFindParty service which can't be improved because they return an EntityListIterator. So methods using them must be carefully crafted to close the EntityListIterator.  Most where already documented (in the framework). I completed few in
applications at r1798495.





> EntityListIterator closed but not in case of exception
> ------------------------------------------------------
>
>                 Key: OFBIZ-9385
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-9385
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: ALL COMPONENTS
>    Affects Versions: Trunk
>            Reporter: Jacques Le Roux
>            Assignee: Jacques Le Roux
>            Priority: Minor
>             Fix For: Upcoming Release
>
>
> I found several cases. This is an improvement only because no cases were reported. But obviously in case of unlucky exception after the EntityListIterator creation and before it's closed the EntityListIterator remains in memory. It should be closed in EntityListIterator.finalize() but the less happens there the better.
> The solution is to use try-with-ressources when (easily) possible (some cases are quite convoluted)



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)