tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Kujtan" <akuj...@evertz.com>
Subject Shutdown Hooks not firing when tomcat is shutdown from within a webapp
Date Tue, 07 Feb 2012 18:19:42 GMT
OS: Windows 7  32bit

Ver.: Apache Tomcat/7.0.25

Jvm: 1.6.0_14-b08

 

I am attaching a shutdown hook from within my webapp to log some info
after tomcat shuts down,

 

    > Runtime.getRuntime().addShutdownHook(mythread, name +
":shutdownHook"));

 

When I run shutdown.bat from the bin folder the hook runs fine and I get
my output. 

 

In some cases however I am forced to shut down tomcat from within the
webapp, in this case it calls,

 

    > org.apache.catalina.startup.Bootstrap.main(new String[] { "stop"
});

 

Which shuts down tomcat, but in this case the shutdown hook does not get
fired. 

 

Can anyone tell me how to programmatically shut down tomcat such that
the hooks will still fire? 

What is the difference between running shutdown.bat and calling stop
programmatically?

 

Regards,

Andrew Kujtan

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message