Created
September 13, 2012 11:53
-
-
Save adutra/3713844 to your computer and use it in GitHub Desktop.
Nested Shutdown Hooks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NestedShutdownHooks { | |
public static void main(String[] args) { | |
Runtime.getRuntime().addShutdownHook(new Thread() { | |
public void run() { | |
System.out.println("foo"); | |
Runtime.getRuntime().addShutdownHook(new Thread() { | |
public void run() { | |
System.out.println("bar"); | |
} | |
}); | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment