/** * Add a shutdown hook. The {@link #shutdown} phase will be automatically called while the process * exists. * * @throws IOException when the operation fails */ public void registerJVMOnExistHook() throws IOException { Runtime.getRuntime().addShutdownHook(new ShutdownHook(this)); }