commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sandeep More <moresand...@gmail.com>
Subject Re: [pool] Way to destroy all the objects in a pool
Date Fri, 20 Jan 2012 18:59:56 GMT

On Jan 20, 2012, at 12:43 PM, Gary Gregory <garydgregory@gmail.com> wrote:

> On Jan 20, 2012, at 13:29, Sandeep More <moresandeep@gmail.com> 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 <garydgregory@gmail.com>wrote:
>> 
>>> On Thu, Jan 19, 2012 at 8:21 PM, Sandeep More <moresandeep@gmail.com>
>>> 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: user-unsubscribe@commons.apache.org
>>>> For additional commands, e-mail: user-help@commons.apache.org
>>>> 
>>>> 
>>> 
>>> 
>>> --
>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>> 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: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message