@Override
  public void stopAndRemoveReplicaFromThreadPool(ReplicaId replicaId) throws InterruptedException {
    threadQueueLock.lock();
    logger.info("Stopping and removing replica {} from thread pool", replicaId);
    FileCopyThread fileCopyThread = replicaToFileCopyThread.get(replicaId);

    if (fileCopyThread == null || !fileCopyThread.isAlive()) {
      logger.info("No thread found for replica {}. Nothing to stop.", replicaId);
      threadQueueLock.unlock();
      return;
    }
    long threadShutDownInitiationTime = System.currentTimeMillis();
    logger.info("Stopping thread for replica {}", replicaId);
    fileCopyThread.shutDown();
    logger.info("Thread for replica {} stopped in {} ms", replicaId,
        System.currentTimeMillis() - threadShutDownInitiationTime);
    threadQueueLock.unlock();
  }
Stops and removes a replica's associated thread from the thread pool.
If the thread doesn't exist or is not alive, the method returns without action.
@param replicaId The replica whose thread should be stopped
@throws InterruptedException if the thread shutdown is interrupted
ambry-file-transfer/src/main/java/com/github/ambry/filetransfer/DiskAwareFileCopyThreadPoolManager.java