-
1. Re: how to use shutdownHookBehavior
dex80526 Jun 4, 2012 3:20 PM (in response to dex80526)No response yet. I'll extend the question a bit. How do I hookup a customerized shutdown hooker? For example, I may want to call some DB shutdown code in the hooker.
-
2. Re: how to use shutdownHookBehavior
mgencur Jun 5, 2012 10:03 AM (in response to dex80526)You cannot add your own shutdown hook to infinispan. You can just change the behavior regarding when the the default shutdown hook is registered. The default implementation can be found at GlobalComponentRegistry.java.
-
3. Re: how to use shutdownHookBehavior
galder.zamarreno Jun 5, 2012 10:52 AM (in response to mgencur)From the ShutdownHookBehavior enum javadoc:
/**
* By default a shutdown hook is registered if no MBean server (apart from the JDK default) is detected.
*/
DEFAULT,
/**
* Forces the cache to register a shutdown hook even if an MBean server is detected.
*/
REGISTER,
/**
* Forces the cache NOT to register a shutdown hook, even if no MBean server is detected.
*/
DONT_REGISTER
The idea here is that if a JVM is shutdown, whether the Infinsipan resources should be cleared or not. In a managed environment, such as an AS, it has its own shutdown hook that will guarantee that all services are shutdown, so normally there's no need for one. In standalone apps, it's usual to see a shutdown hook to shut all daemon threads...etc.
-
4. Re: how to use shutdownHookBehavior
dex80526 Jun 5, 2012 11:27 AM (in response to galder.zamarreno)Thanks for all the responses.
My real issue is that TOMCAT complains some processes (threads related to JDBC cache loader) are not removed when the application stops. I'll try some other approaches.
-
5. Re: how to use shutdownHookBehavior
galder.zamarreno Jun 6, 2012 3:01 AM (in response to dex80526)Right, the best is for your app to shutdown the cache manager when it undeploys or stops, if that's somehow possible. Alternatively, you could also try REGISTER as shutdown hook and see if that works.