Try adding a shutdown hook. e.g.
new ShutdownHook().register();
/**
* Provides a shutdown hook for shutting down the pool.
*/
private class ShutdownHook extends Thread {
/**
* Registers this hook for invocation during shutdown.
*/
public void register() {
Runtime.getRuntime().addShutdownHook(this);
}
/**
* Closes the pool and each of the objects within it.
*/
public void run() {
try {
// Do something.
}
catch (Exception e) {
throw new SystemException(e);
}
}
}
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]