code: public void shutdown(final long timeout, final TimeUnit timeUnit) throws TimeoutException
      {
          final long timeOutAt = System.currentTimeMillis() + timeUnit.toMillis(timeout);
          while (hasBacklog())
          {
              if (timeout >= 0 && System.currentTimeMillis() > timeOutAt)
              {
                  throw TimeoutException.INSTANCE;
              }
              // Busy spin
          }
          halt();
      }
docs: <p>Waits until all events currently in the disruptor have been processed by all event processors
  and then halts the processors.</p>
  
  <p>This method will not shutdown the executor, nor will it await the final termination of the
  processor threads.</p>
  
  @param timeout  the amount of time to wait for all events to be processed. <code>-1</code> will give an infinite timeout
  @param timeUnit the unit the timeOut is specified in
  @throws TimeoutException if a timeout occurs before shutdown completes.