public static void executorShutDown ( ExecutorService executorService , long timeOutSec ) { try { executorService . shutdown ( ) ; executorService . awaitTermination ( timeOutSec , TimeUnit . SECONDS ) ; } catch ( Exception e ) { logger . warn ( "Error while stoping executor service." , e ) ; } }
Wait to shutdown service