On Jan 20, 2012, at 13:29, Sandeep More <moresand...@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? 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...


> 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 <garydgreg...@gmail.com>wrote:
>
>> On Thu, Jan 19, 2012 at 8:21 PM, Sandeep More <moresand...@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-unsubscr...@commons.apache.org
>>> For additional commands, e-mail: user-h...@commons.apache.org
>>>
>>>
>>
>>
>> --
>> E-Mail: garydgreg...@gmail.com | ggreg...@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-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

Reply via email to