public static void stopProcessOnShutdown ( final Process process ) { Runtime . getRuntime ( ) . addShutdownHook ( new Thread ( ( ) -> { try { process . stop ( ) ; } catch ( Throwable t ) { LOG . error ( "Failed to stop process" , t ) ; } } , "alluxio-process-shutdown-hook" ) ) ; }
Adds a shutdown hook that will be invoked when a signal is sent to this process .