On Jan 20, 2012, at 12:43 PM, Gary Gregory <[email protected]> wrote:
> On Jan 20, 2012, at 13:29, Sandeep More <[email protected]> wrote: > >> Thanks Gary, >> Sorry for not being clear with my question. You are right, clear() method >> calls the destroyObject() method but only for the objects sitting idle in >> the pool. >> >> What I want is a way to call destroyObject() method on all the objects in >> the pool (including the active abjects). > > Do you mean the objects that have borrowed out of the pool? Yup ! > The pools > do not track objects once they are borrowed out. The pools start > tracking an object again once returned. > > I think this might change in 2.0... So, there is no way for a pool to call destroyObject() method on active objects currently right ? > > >> This might not sound like a good >> idea but I would like to make sure that when my program terminates >> (abruptly) all the objects in the pool are properly destroyed. >> >> Thanks, >> /srm >> >> On Fri, Jan 20, 2012 at 10:36 AM, Gary Gregory <[email protected]>wrote: >> >>> On Thu, Jan 19, 2012 at 8:21 PM, Sandeep More <[email protected]> >>> wrote: >>> >>>> Hello, >>>> I was wondering whether there is a method which one would call to destroy >>>> all the objects in a pool. >>>> >>>> To be specific, I am using ‘GenericObjectPool’ to create a pool >>> consisting >>>> of object ‘MyObject’ (implements PoolableObjectFactory). >>>> ‘destroyObject()’ method is implemented for ‘MyObject’ which does some >>>> cleaning. >>>> >>>> Is there a way for me to call the ‘destroyObject()’ method for all the >>>> objects in the pool from ‘GenericObjectPool’, something like ‘clear()’ >>> but >>>> which works on ‘destroyObject()’ method of all the objects in the pool ? >>>> >>> >>> Hello, >>> >>> clear is documented to call PoolableObjectFactory#destroyObject(Object). >>> What am I missing? >>> >>> Gary >>> >>> >>>> Thanks in advance, >>>> /srm >>>> >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [email protected] >>>> For additional commands, e-mail: [email protected] >>>> >>>> >>> >>> >>> -- >>> E-Mail: [email protected] | [email protected] >>> JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0 >>> Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK >>> Blog: http://garygregory.wordpress.com >>> Home: http://garygregory.com/ >>> Tweet! http://twitter.com/GaryGregory >>> > > --------------------------------------------------------------------- > 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]
