On 07/02/2012 22:20, Andrew Kujtan wrote: >> -----Original Message----- >> From: Chema [mailto:demablo...@gmail.com] >> Sent: Tuesday, February 07, 2012 5:12 PM >> To: Tomcat Users List >> Subject: Re: Shutdown Hooks not firing when tomcat is shutdown from >> within a webapp >> >>>> Can I see ApplicationShutdownHooks source code ? >>> >>> That is located in java.lang, you can see the source online... >>> >> >> Sorry, I meant about *your* app's shutdown hook. >> > > For debugging I'm only using this, and it does run successfully. The > shutdown hook is not blocking anything, > > Runtime.getRuntime().addShutdownHook( > new Thread(new Runnable(){ > @Override > public void run() { > System.out.println("HARI-KIRI SUCCESSFUL!"); > } > }, "shutdownHook"));
That's because there's nothing here that is loaded by the webapp classloader. You are probably causing the app's classloader to hang around when you add the shutdown hook from within the app. If you really need something to run during shutdown, use a Tomcat-specific LifecycleListener. p >>>> What 's com.evertz.registry.ServerRegistryListener ? >> >> Right >> >>> >>> This is just the listener that triggers the shutdown call. >>> That the trace shows it that I call System.exit(0), which then runs >> the shutdown hooks, but then gets stuck running the >> CatalinaShutdownHook. It looks like all CatalinaShutdownHook does is >> call catalina.stop, I don't really know how to figure out what it is >> waiting on though. >>>> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > -- [key:62590808]
signature.asc
Description: OpenPGP digital signature