sanjeev :
I have tomcat server running. and it crashes suddenly for some reason... however I am trying to find the error.
Is there a function in tomcat or java like beforeExit()
or ifCrashed()
which I can override and write some code there like notifying myself if server crashes for some reason.
Danylo Zatorsky :
You could try using shut down hooks which are executed on system exit. It's not guaranteed though that it will be executed on a hard crash like SIGKILL but this may be an option in some cases:
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
// Implementation goes here..;
}
});
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=440166&siteId=1