code: private boolean possiblyPause() throws InterruptedException
    {
      pauseLock.lockInterruptibly();
      try {
        if (pauseRequested) {
          status = Status.PAUSED;
          hasPaused.signalAll();
  
          while (pauseRequested) {
            log.info("Pausing ingestion until resumed");
            shouldResume.await();
          }
  
          status = Status.READING;
          shouldResume.signalAll();
          log.info("Ingestion loop resumed");
          return true;
        }
      }
      finally {
        pauseLock.unlock();
      }
  
      return false;
    }
docs: Checks if the pauseRequested flag was set and if so blocks:
  a) if pauseMillis == PAUSE_FOREVER, until pauseRequested is cleared
  b) if pauseMillis != PAUSE_FOREVER, until pauseMillis elapses -or- pauseRequested is cleared
  <p>
  If pauseMillis is changed while paused, the new pause timeout will be applied. This allows adjustment of the
  pause timeout (making a timed pause into an indefinite pause and vice versa is valid) without having to resume
  and ensures that the loop continues to stay paused without ingesting any new events. You will need to signal
  shouldResume after adjusting pauseMillis for the new value to take effect.
  <p>
  Sets paused = true and signals paused so callers can be notified when the pause command has been accepted.
  <p>
  Additionally, pauses if all partitions assignments have been read and pauseAfterRead flag is set.
  
  @return true if a pause request was handled, false otherwise