Yes.
-David
On May 14, 2009, at 7:18 PM, snowch wrote:
If I am using an ofbiz form to display a paginated list, does the
form take
care of closing the EntityListIterator at the end of each request?
David E Jones-3 wrote:
In a webapp you simply can't leave the connection open, you have to
close it at the end of each page request.
Feel free to try leaving it open between requests and then put the
server under a load... what always happens (yep, always, no silver
lining scenarios here...) is that the connection pool and related
resources are consumed quickly and while the hardware is under almost
no load the server starts rejecting requests or things simply time
out.
It's fairly basic stuff actually, but unfortunately transaction
management is a powerful tool with a lot of powerful bad side-effects
if you don't use it right. It may seem crazy but it is frighteningly
common that developers write bad tx mgmt code and it brings down
production servers, sometimes causing a project to be cancelled
because clients loose confidence in the system...
In a desktop application you can keep connections opened longer, but
it is still risky and usually a lot of monitoring code is required to
clean things up in possible failure states. In a webapp the
monitoring
and cleanup code has to address lots of tough scenarios and usually
conflicts with things that are made to allow apps to scale well...
and
those conflicts make it impossible no matter how good a programmer
you
are... you have to choose between scalability and saving on re-query
time, and in the real world scalability is usually far more important
and will actually result in lower response times overall.
-David
On May 14, 2009, at 8:30 AM, snowch wrote:
Hi Forum,
In the GenericDelegator findListIteratorByCondition() methods, there
is the
following warning regarding the EntityListIterator:
NOTE THAT THIS MUST BE CLOSED WHEN YOU ARE DONE WITH IT, AND DON'T
LEAVE IT
OPEN TOO LONG BEACUSE IT WILL MAINTAIN A DATABASE CONNECTION.
If I have a user paging through a data list form, how can I know
when they
have finished so that the EntityListIterator can be closed?
Many thanks in advance,
Chris
--
View this message in context:
http://www.nabble.com/EntityListIterator-and-open-connections-tp23541834p23541834.html
Sent from the OFBiz - User mailing list archive at Nabble.com.
--
View this message in context:
http://www.nabble.com/EntityListIterator-and-open-connections-tp23541834p23551852.html
Sent from the OFBiz - User mailing list archive at Nabble.com.