Not sure if finalizers will be invoked if the JVM 'crashes'. Finalizers will work in case there is a graceful exit of JVM.
On 3/30/07, Will Pugh <[EMAIL PROTECTED]> wrote:
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 > <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]