tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pid <...@pidster.com>
Subject Re: Shutdown Hooks not firing when tomcat is shutdown from within a webapp
Date Wed, 08 Feb 2012 08:06:25 GMT
On 07/02/2012 22:20, Andrew Kujtan wrote:
>> -----Original Message-----
>> From: Chema [mailto:demablogia@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-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


-- 

[key:62590808]


Mime
View raw message