Skip to content

Instantly share code, notes, and snippets.

@adutra
Created September 13, 2012 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adutra/3713844 to your computer and use it in GitHub Desktop.
Save adutra/3713844 to your computer and use it in GitHub Desktop.
Nested Shutdown Hooks
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