code: private void rollLog() {
      final File file = currentFile;
      if (file == null) {
        throw new IllegalStateException("currentFile is null"); // shouldn't happen
      }
  
      final OutputStream stream = currentStream;
      if (stream == null) {
        throw new IllegalStateException("currentStream is null"); // shouldn't happen
      }
  
      // reset class members
      this.currentFile = null;
      this.currentStream = null;
  
      // compress file, if needed
      if (compressor == null) {
        return; // compression is not needed
      }
  
      // start new compression thread
      final Thread compressingThread = new Thread(new Runnable() {
        @Override
        public void run() {
          log.trace("Closing output stream of target file={}", file);
  
          // close old stream
          try {
            stream.close();
          } catch (IOException e) {
            log.error("Unable to properly close output stream", e);
          }
  
          // compress file contents
          compressFileContents(compressor, file);
  
          // mark current thread as null
          currentCompressingThread = null;
        }
      });
      compressingThread.run();
      currentCompressingThread = compressingThread;
    }
docs: Writes older log into the file and updates current output stream