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);
        }
    }
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

@param executorService Executor service to shutdown
@param timeOutSec Time we wait for