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

 

Reply via email to