Release all locks for a task and remove task from set of active tasks. Does nothing if the task is not currently locked or not an active task.

@param task task to unlock
432101
public void remove(final Task task)
  {
    giant.lock();
    try {
      try {
        log.info("Removing task[%s] from activeTasks", task.getId());
        for (final TaskLockPosse taskLockPosse : findLockPossesForTask(task)) {
          unlock(task, taskLockPosse.getTaskLock().getInterval());
        }
      }
      finally {
        activeTasks.remove(task.getId());
      }
    }
    finally {
      giant.unlock();
    }
  }
34989
void performCleanUp(@Nullable Runnable task) {
    evictionLock.lock();
    try {
      maintenance(task);
    } finally {
      evictionLock.unlock();
    }
    if ((drainStatus() == REQUIRED) && (executor == ForkJoinPool.commonPool())) {
      scheduleDrainBuffers();
    }
  }
1019422
public static void processTask(Task task) {
    logger.finest("Processing task " + task);
    try {
      switch (task.getType()) {
        case RUN_JOB:
          runJob((RunJobTask) task);
          break;
        case HANDLE_SLOT_FILLED:
          handleSlotFilled((HandleSlotFilledTask) task);
          break;
        case FINALIZE_JOB:
          finalizeJob((FinalizeJobTask) task);
          break;
        case FAN_OUT:
          handleFanoutTaskOrAbandonTask((FanoutTask) task);
          break;
        case CANCEL_JOB:
          cancelJob((CancelJobTask) task);
          break;
        case DELETE_PIPELINE:
          DeletePipelineTask deletePipelineTask = (DeletePipelineTask) task;
          try {
            backEnd.deletePipeline(
                deletePipelineTask.getRootJobKey(), deletePipelineTask.shouldForce(), false);
          } catch (Exception e) {
            logger.log(Level.WARNING, "DeletePipeline operation failed.", e);
          }
          break;
        case HANDLE_CHILD_EXCEPTION:
          handleChildException((HandleChildExceptionTask) task);
          break;
        case DELAYED_SLOT_FILL:
          handleDelayedSlotFill((DelayedSlotFillTask) task);
          break;
        default:
          throw new IllegalArgumentException("Unrecognized task type: " + task.getType());
      }
    } catch (AbandonTaskException ate) {
      // return 200;
    }
  }
405637
public void setTasks(java.util.Collection<ImportTask> tasks) {
        if (tasks == null) {
            this.tasks = null;
            return;
        }

        this.tasks = new java.util.ArrayList<ImportTask>(tasks);
    }
1323526
public Task removeAllSnapshots_Task(Boolean consolidate) throws SnapshotFault, TaskInProgress, InvalidState, RuntimeFault, RemoteException {
        ManagedObjectReference mor = getVimService().removeAllSnapshots_Task(getMOR(), consolidate);
        return new Task(getServerConnection(), mor);
    }
502455
public synchronized void enqueue(DownloadTask task) {
        taskList.add(task);
        Collections.sort(taskList);

        if (!paused && !looping) {
            looping = true;
            startNewLooper();
        }
    }
1005145
public function delete(Task $task): void
    {
        $id = $task->getId();

        $task->setId(null);

        $this->client->delete($this->prepareUrlForKey('delete-task', ['id' => $id]));
    }
404981
public List<TaskLock> findLocksForTask(final Task task)
  {
    giant.lock();

    try {
      return Lists.transform(
          findLockPossesForTask(task), new Function<TaskLockPosse, TaskLock>()
          {
            @Override
            public TaskLock apply(TaskLockPosse taskLockPosse)
            {
              return taskLockPosse.getTaskLock();
            }
          }
      );
    }
    finally {
      giant.unlock();
    }
  }
1098911
@Override
    public void requeue(Task task) {
        this.inprocess.remove(task);
        task.incrementAttempts();
        this.queue.add(task);
    }
300087
public final void release(TotalOrderRemoteTransactionState state) {
      TotalOrderLatch synchronizedBlock = state.getTransactionSynchronizedBlock();
      if (synchronizedBlock == null) {
         //already released!
         return;
      }
      Collection<Object> lockedKeys = state.getLockedKeys();
      synchronizedBlock.unBlock();
         for (Object key : lockedKeys) {
            keysLocked.remove(key, synchronizedBlock);
         }
      if (trace) {
         log.tracef("Release %s and locked keys %s. Checking pending tasks!", synchronizedBlock, lockedKeys);
      }
      state.reset();
   }
757581
function(task, suppressCallbacks) {
  // subtask is now done
  task.state = DONE;

  delete sTasks[task.id];
  if(sVL >= 1) {
    forge.log.verbose(cat, '[%s][%s] finish',
      task.id, task.name, task);
  }

  // only do queue processing for root tasks
  if(task.parent === null) {
    // report error if queue is missing
    if(!(task.type in sTaskQueues)) {
      forge.log.error(cat,
        '[%s][%s] task queue missing [%s]',
        task.id, task.name, task.type);
    } else if(sTaskQueues[task.type].length === 0) {
      // report error if queue is empty
      forge.log.error(cat,
        '[%s][%s] task queue empty [%s]',
        task.id, task.name, task.type);
    } else if(sTaskQueues[task.type][0] !== task) {
      // report error if this task isn't the first in the queue
      forge.log.error(cat,
        '[%s][%s] task not first in queue [%s]',
        task.id, task.name, task.type);
    } else {
      // remove ourselves from the queue
      sTaskQueues[task.type].shift();
      // clean up queue if it is empty
      if(sTaskQueues[task.type].length === 0) {
        if(sVL >= 1) {
          forge.log.verbose(cat, '[%s][%s] delete queue [%s]',
            task.id, task.name, task.type);
        }
        /* Note: Only a task can delete a queue of its own type. This
         is used as a way to synchronize tasks. If a queue for a certain
         task type exists, then a task of that type is running.
         */
        delete sTaskQueues[task.type];
      } else {
        // dequeue the next task and start it
        if(sVL >= 1) {
          forge.log.verbose(cat,
            '[%s][%s] queue start next [%s] remain:%s',
            task.id, task.name, task.type,
            sTaskQueues[task.type].length);
        }
        sTaskQueues[task.type][0].start();
      }
    }

    if(!suppressCallbacks) {
      // call final callback if one exists
      if(task.error && task.failureCallback) {
        task.failureCallback(task);
      } else if(!task.error && task.successCallback) {
        task.successCallback(task);
      }
    }
  }
}
543
public void addTask (ExecutorTask task)
    {
        for (int ii=0, nn=_queue.size(); ii < nn; ii++) {
            ExecutorTask taskOnQueue = _queue.get(ii);
            if (taskOnQueue.merge(task)) {
                return;
            }
        }

        // otherwise, add it on
        _queue.add(task);

        // and perhaps start it going now
        if (!_executingNow) {
            checkNext();
        }
    }
491461
private void setJobCleanupTaskState(Task task) {
    if (task.isJobCleanupTask()) {
      if (jobFailed) {
        task.setJobCleanupTaskState(
            org.apache.hadoop.mapreduce.JobStatus.State.FAILED);
      } else if (jobKilled) {
        task.setJobCleanupTaskState(
            org.apache.hadoop.mapreduce.JobStatus.State.KILLED);
      } else {
        task.setJobCleanupTaskState(
            org.apache.hadoop.mapreduce.JobStatus.State.SUCCEEDED);
      }
    }
  }
908246
public void setTaskSets(java.util.Collection<String> taskSets) {
        if (taskSets == null) {
            this.taskSets = null;
            return;
        }

        this.taskSets = new com.amazonaws.internal.SdkInternalList<String>(taskSets);
    }
620237
public ItemRequest<Task> removeDependents(String task) {
    
        String path = String.format("/tasks/%s/removeDependents", task);
        return new ItemRequest<Task>(this, Task.class, path, "POST");
    }
706865
function(task) {

		if (this._active_tasks.indexOf(task) == -1) {

			this._active_tasks.push(task);

		}

		this._enable();

		if (!this.is_running) {
			this._enable();
			this.is_running = true;
		}

	}
213512
public void setTaskExecutions(java.util.Collection<TaskExecutionListEntry> taskExecutions) {
        if (taskExecutions == null) {
            this.taskExecutions = null;
            return;
        }

        this.taskExecutions = new java.util.ArrayList<TaskExecutionListEntry>(taskExecutions);
    }