How can I run code when the JRE is shutting down?

Davanum Srinivas

In JDK 1.3 you can use the following snippet:

Runtime.getRuntime().addShutdownHook(new Thread() {
    public void run() { 
    // Your code goes here.
For more information, look at Sun's Design of the Shutdown Hooks document.
0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact