code: @Override
      protected void beforePolling() throws IOException {
          // Don't rotate if we are not running
          if (isRunning &&
                  (writer.getLength() > maxFileSize ||
                          System.currentTimeMillis() > nextRotation)) {
              rotate();
          }
      }
docs: Before polling messages from the queue, it should check whether to rotate
  the file and start to write to new file.
  
  @throws java.io.IOException