Good points, thank you.
Re. pont 1 (closing jdbc objects) I observe the query associated with
retrieving these large objects is getObjectListbySQL
My code for this, which I don't quite recall how I came up with and
which I have been using for many years now, is as below....
Would appreciate a "code review" of the same to make sure things are
handled correctly, memory wise.
best
Paul
public Object[] getObjectListbySQL(Object obj, String sql) {
Criteria criteria = null;
Collection objects = null;
PersistenceBroker broker = null;
if(obj == null)
return null;
try {
broker = PersistenceBrokerFactory.defaultPersistenceBroker();
broker.clearCache();
// get the QueryBySQL
QueryBySQL q = QueryFactory.newQuery(obj.getClass(), sql);
objects = (Collection)broker.getCollectionByQuery(q);
//System.out.println("from getObjectListbySQL, collection
length is: " + objects.size());
} catch (Exception sqle) {
sqle.printStackTrace();
String msg = sqle.getMessage();
broker.close();
return null;
}
if(broker != null)
{
broker.close(); //
Release broker instance to the broker-pool
}
return objects.toArray();
}
On 10/25/2011 3:10 AM, Laurent Medioni wrote:
+ No1 potential memory leak ever: be sure to close your jdbc objects
whatever happens, provide catch blocks to close objects when
instantiations go wrong + make sure the close() methods are always
called at some point from your code (as soon as you have read the
resultSet).
But, as already said, storing large objects in continuations is a sure
recipe for failure ;)
You should configure the Continuation Manager with something like:
<continuations-manager logger="flow" session-bound-continuations="true"
time-to-live="3600000">
<expirations-check type="periodic">
<offset>180000</offset>
<period>180000</period>
</expirations-check>
</continuations-manager>
This will give continuations a time to live of 1 hour, which is probably
more than enough for replaying continuations if needed. And when the
session expires everything will be GCed, as soon as possible/needed...
Laurent
The information in this e-mail and any attachments is confidential and may be
legally privileged.
It is intended solely for the addressee or addressees. Any use or disclosure of
the contents
of this e-mail/attachments by a not intended recipient is unauthorized and may
be unlawful.
If you have received this e-mail in error please notify the sender.
Please note that any views or opinions presented in this e-mail are solely
those of the author and
do not necessarily represent those of TEMENOS.
We recommend that you check this e-mail and any attachments against viruses.
TEMENOS accepts no liability for any damage caused by any malicious code or
virus transmitted by this e-mail.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]