Wednesday, July 14, 2010

How to detect JVM Shutdown

Runtime.getRuntime().addShutdownHook(new ShutdownHook());

boolean jvmShuttingDown = false;


private class ShutdownHook extends Thread {
        public void run() {
               jvmShuttingDown = true;
        }
}

No comments:

Post a Comment