commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: [pool] Way to destroy all the objects in a pool
Date Fri, 20 Jan 2012 20:48:03 GMT
On 20/01/2012 20:19, Gary Gregory wrote:
> On Fri, Jan 20, 2012 at 1:59 PM, Sandeep More <moresandeep@gmail.com> wrote:
> 
>>
>> 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 ?
>>
> 
> That's how I understand it. Anyone else?

Correct. In pool 1.x once an object leaves the pool, there is no way for
the pool to track that object.

In pool 2.x it will be possible to do this as active, idle and all
objects may be obtained from the pool.

One way to work around this in poll 1.x is to modify your object factory
to keep a reference to the objects it has created.

Mark

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


Mime
View raw message