code: @Override
    public void stop() {
      // Steps to shutdown:
      // 1. Gracefully shut down the runnables running in the executors.
      // 2. Shutdown the executors.
      // 3. Shutdown the clients. This needs to happen after the executors is shutdown because
      //    runnables running in the executors might be using the clients.
      mSessionCleaner.stop();
      // The executor shutdown needs to be done in a loop with retry because the interrupt
      // signal can sometimes be ignored.
      try {
        CommonUtils.waitFor("block worker executor shutdown", () -> {
          getExecutorService().shutdownNow();
          try {
            return getExecutorService().awaitTermination(100, TimeUnit.MILLISECONDS);
          } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new RuntimeException(e);
          }
        });
      } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
        throw new RuntimeException(e);
      } catch (TimeoutException e) {
        throw new RuntimeException(e);
      }
      mBlockMasterClientPool.release(mBlockMasterClient);
      try {
        mBlockMasterClientPool.close();
      } catch (IOException e) {
        LOG.warn("Failed to close the block master client pool with error {}.", e.getMessage());
      }
      mFileSystemMasterClient.close();
    }
docs: Stops the block worker. This method should only be called to terminate the worker.