How does CTRL-C work with Java program
问题 When I press ctrl - c in console in what sequence are application threads stopped and shutdown hooks called? 回答1: According to the javadocs, the registered shutdown hooks are called in an unspecified order when the JVM starts shutting down; e.g. in response to a CTRL-C. Application threads are not "stopped" in any well defined way. Indeed, they could continue running up right until the process exits. If you want your threads to be shut down in an orderly fashion, you need to do something in a