commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Will Pugh <>
Subject Re: pool - cleaning up resources on JVM exit
Date Fri, 30 Mar 2007 18:36:23 GMT
Finalizers can be a pain, but might for this scenario they might work 
for you.

Sandy McArthur wrote:
> When the JVM crashes there is no cleaning up, the JVM just exits and
> the OS will clean up what it can. Pool cannot recover from a JVM
> crash.
> When the JVM exits there will be a bit more clean up. Whether or not
> it's a full clean up or something else will depend on your use of the
> shutdown handlers. Pool does not use shutdown handlers.
> If a borrowed object isn't returned to the pool and "lost" the JVM's
> garbage collector should take care of it.
> PoolableObjectFactory.destroyObject won't get a chance to clean up
> that object.
> If you want a way to clean up after an object instance is garbage
> collected you should look into ReferenceQueue and taking clean up
> action when an instance is no more.
> HTH.
> On 3/30/07, Conrad CRAMPTON PSE 52704
> <> wrote:
>> Hi,
>> Is there anyway of clearing up resources from a GenericObjectPool when
>> the JMV closes (crashes)? I have objects that maintain a connection to a
>> service that need to be closed when the web server is restarted or
>> crashes.
>> Also, if an object is borrowed from the pool and isn't returned because
>> of interruption in the web application flow or some other reason, does
>> it get 'swept up' by the evictor thread eventually or is there some
>> other way of returning this to the pool or simply just destroying it for
>> it to be recreated in the pool when necessary?
>> Thanks for your consideration
>> Conrad

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message