[jboss-user] [JBossCache] - Problem with ShutdownHook
do-not-reply at jboss.com
Fri Sep 28 10:01:59 EDT 2007
I found possible problem in class org.jboss.cache.CacheImpl.java in method internalStart() at line ~820: "Runtime.getRuntime().addShutdownHook(shutdownHook);"
It works perfectly in stand-alone environment, but in MBeanServer it may cause problems.
MBean server has internal life-cycle definition for mbeans, and defines "stop" method for mbeans. When ShutdownHookMBean is processed in MBeanServer, the server stops mbeans in order reversed to their start. When MBeans depending on "CacheMBean" in stop method need to do some finalization work with cache (e.g. remove/update nodes), exception "java.lang.IllegalStateException" throwns, because Cache had already switched to stop state (due to hardcoded shutdown hook). Solution is to check runtime environment and in depend on this check to rely on shutdownhook (as it is now) or to stop method.
PS: Sorry for my english.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4089709#4089709
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4089709
More information about the jboss-user