public static void awaitTermination ( ExecutorService executorService , long timeoutMillis ) { if ( executorService . isTerminated ( ) ) return ; log . info ( "Start Terminating !!! - {}, timeoutMillis - {}" , executorService , timeoutMillis ) ; long startTimeMillis = System . currentTimeMillis ( ) ; try { executorService . awaitTermination ( timeoutMillis , TimeUnit . MILLISECONDS ) ; } catch ( InterruptedException e ) { log . warn ( "Timeout Occur !!! - {}, timeoutMillis - {}" , executorService , timeoutMillis ) ; } log . info ( "Terminated !!! - {} took {} ms" , executorService , startTimeMillis - System . currentTimeMillis ( ) ) ; }
Await termination .