code: public synchronized void shutdown()
     {
        shutdown.set(true);
  
        if (pool != null)
           pool.shutdown();
  
        if (scheduledExecutorService != null)
        {
           if (scheduledGraceful != null && !scheduledGraceful.isDone())
              scheduledGraceful.cancel(true);
  
           scheduledGraceful = null;
           scheduledExecutorService.shutdownNow();
           scheduledExecutorService = null;
        }
  
        if (gracefulCallback != null)
        {
           gracefulCallback.done();
           gracefulCallback = null;
        }
     }
docs: {@inheritDoc}