code: public void prepareShutdown(int seconds, GracefulCallback cb)
     {
        shutdown.set(true);
  
        if (gracefulCallback == null) 
           gracefulCallback = cb;
  
        if (pool != null)
           pool.flush(FlushMode.GRACEFULLY);
  
        if (seconds > 0 && scheduledGraceful == null)
        {
           if (scheduledExecutorService == null)
              scheduledExecutorService = Executors.newScheduledThreadPool(1);
  
           scheduledGraceful =
              scheduledExecutorService.schedule(new ConnectionManagerShutdown(this), seconds, TimeUnit.SECONDS);
        }
     }
docs: {@inheritDoc}