build-coordinator/src/main/java/org/jboss/pnc/coordinator/builder/BuildQueue.java
public synchronized void removeTask(BuildTask task) {
        log.debug("removing task: {}", task);
        if (tasksInProgress.remove(task)) {
            availableBuildSlots.release();
        }
        if (readyTasks.remove(task)) {
            log.debug("The task {} has been removed from readyTasks.", task);
        }

        if (waitingTasksWithCallbacks.remove(task) != null) {
            log.debug("The task {} has been removed from waitingTasks.", task);
        }

        if (unfinishedTasks.remove(task)) {
            log.debug("The task {} has been removed from unfinishedTasks.", task);
        }
    }
public synchronized void removeTask(BuildTask task) {
        log.debug("removing task: {}", task);
        if (tasksInProgress.remove(task)) {
            availableBuildSlots.release();
        }
        if (readyTasks.remove(task)) {
            log.debug("The task {} has been removed from readyTasks.", task);
        }

        if (waitingTasksWithCallbacks.remove(task) != null) {
            log.debug("The task {} has been removed from waitingTasks.", task);
        }

        if (unfinishedTasks.remove(task)) {
            log.debug("The task {} has been removed from unfinishedTasks.", task);
        }
    }
remove task from the queue.
This method should be invoked if the task is completed, either successfully, or with error (including rejected build)

@param task task to be removed