void close() {
    if (isOpen.compareAndSet(true, false)) {
      synchronized (chunkFillerSynchronizer) {
        if (isChunkFillerThreadAsleep) {
          chunkFillerThreadMaySleep = false;
          forceChunkFillerThreadToSleep = false;
          chunkFillerSynchronizer.notify();
        }
      }
      try {
        chunkFillerThread.join(NonBlockingRouter.SHUTDOWN_WAIT_MS);
      } catch (InterruptedException e) {
        logger.error("Caught interrupted exception while waiting for chunkFillerThread to finish");
        Thread.currentThread().interrupt();
      }
      completePendingOperations();
    }
  }
Close the PutManager.
First notify the chunkFillerThread about closing and wait for it to exit. Then, complete all existing operations.
ambry-router/src/main/java/com/github/ambry/router/PutManager.java