For performance reasons do not use the EntityListIterator.hasNext()

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

For performance reasons do not use the EntityListIterator.hasNext()

Jacques Le Roux
Administrator
Hi,

While working on EntityListIterator with try-with-ressources I noticed this message

2017-06-02 11:50:33,328 |jsse-nio-8443-exec-6 |EntityListIterator            |W| For performance reasons do not use the EntityListIterator.hasNext()
method, just call next() until it returns null; see JavaDoc
  comments in the EntityListIterator class for details and an example
java.lang.Exceptionfbiz
     at org.apache.ofbiz.entity.util.EntityListIterator.hasNext(EntityListIterator.java:254) [ofbiz.jar:?]
   at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2028) [groovy-all-2.4.10.jar:2.4.10]
         at org.codehaus.groovy.runtime.dgm$161.invoke(Unknown Source) [groovy-all-2.4.10.jar:2.4.10]
    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
[groovy-all-2.4.10.jar:2.4.10]
        at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56) [groovy-all-2.4.10.jar:2.4.10]
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) [groovy-all-2.4.10.jar:2.4.10]
         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) [groovy-all-2.4.10.jar:2.4.10]
         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) [groovy-all-2.4.10.jar:2.4.10]
         at OpenOrderItemsReport.run(OpenOrderItemsReport.groovy:92) [script:?]

Do you think it's worth to rewrite in another way the listIt.each closure? I checked there are no other cases.

Jacques