private static void addShutdownHook(final Logger log, final Process process, final String command) {
        Runtime.getRuntime().addShutdownHook(new Thread(command) {
            @Override
            public void run() {
                if (process != null) {
                    log.info("Terminating process [" + command + "]");
                    try {
                        process.destroy();
                    } catch (Exception e) {
                        log.error("Failed to terminate process [" + command + "]");
                    }
                }
            }
        });
    }
private static void addShutdownHook ( final Logger log , final Process process , final String command ) { Runtime . getRuntime ( ) . addShutdownHook ( new Thread ( command ) { @ Override public void run ( ) { if ( process != null ) { log . info ( "Terminating process [" + command + "]" ) ; try { process . destroy ( ) ; } catch ( Exception e ) { log . error ( "Failed to terminate process [" + command + "]" ) ; } } } } ) ; }
==========================================================================================================