private TaskWrapper getSuitableVictimFromPreemptionQueue(TaskWrapper candidate) {
    TaskWrapper taskWrapper;
    synchronized (lock) {
      taskWrapper = preemptionQueue.poll();
      // Note that the code updating the state of the task does it when it's out of the queue.
      // So, the priorities in the queue should be correct; if the top task is not killable then
      // no task in the queue would be killable.
      if (taskWrapper == null) return null;
      if (!canPreempt(candidate, taskWrapper)) {
        // The "most preemptable" task is still too important for us to kill. Put it back.
        insertIntoPreemptionQueueOrFailUnlocked(taskWrapper);
        return null;
      }
      taskWrapper.setIsInPreemptableQueue(false);
      metrics.setExecutorNumPreemptableRequests(preemptionQueue.size());

      return taskWrapper;
    }
  }
Remove the specified taskWrapper from the preemption queue
@param taskWrapper the taskWrapper to be removed
@return true if the element existed in the queue and wasa removed, false otherwise
llap-server/src/java/org/apache/hadoop/hive/llap/daemon/impl/TaskExecutorService.java