/** * Bans all tasks with the specified parent task from execution, cancels all tasks that are currently executing. * <p> * This method is called when a parent task that has children is cancelled. */ public void setBan(TaskId parentTaskId, String reason) { logger.trace("setting ban for the parent task {} {}", parentTaskId, reason); // Set the ban first, so the newly created tasks cannot be registered synchronized (banedParents) { if (lastDiscoveryNodes.nodeExists(parentTaskId.getNodeId())) { // Only set the ban if the node is the part of the cluster banedParents.put(parentTaskId, reason); } } // Now go through already running tasks and cancel them for (Map.Entry<Long, CancellableTaskHolder> taskEntry : cancellableTasks.entrySet()) { CancellableTaskHolder holder = taskEntry.getValue(); if (holder.hasParent(parentTaskId)) { holder.cancel(reason); } } }
/** * Bans all tasks with the specified parent task from execution, cancels all tasks that are currently executing. * <p> * This method is called when a parent task that has children is cancelled. */ public void setBan(TaskId parentTaskId, String reason) { logger.trace("setting ban for the parent task {} {}", parentTaskId, reason); // Set the ban first, so the newly created tasks cannot be registered synchronized (banedParents) { if (lastDiscoveryNodes.nodeExists(parentTaskId.getNodeId())) { // Only set the ban if the node is the part of the cluster banedParents.put(parentTaskId, reason); } } // Now go through already running tasks and cancel them for (Map.Entry<Long, CancellableTaskHolder> taskEntry : cancellableTasks.entrySet()) { CancellableTaskHolder holder = taskEntry.getValue(); if (holder.hasParent(parentTaskId)) { holder.cancel(reason); } } }
/** * Bans all tasks with the specified parent task from execution, cancels all tasks that are currently executing. * <p> * This method is called when a parent task that has children is cancelled. */ public void setBan(TaskId parentTaskId, String reason) { logger.trace("setting ban for the parent task {} {}", parentTaskId, reason); // Set the ban first, so the newly created tasks cannot be registered synchronized (banedParents) { if (lastDiscoveryNodes.nodeExists(parentTaskId.getNodeId())) { // Only set the ban if the node is the part of the cluster banedParents.put(parentTaskId, reason); } } // Now go through already running tasks and cancel them for (Map.Entry<Long, CancellableTaskHolder> taskEntry : cancellableTasks.entrySet()) { CancellableTaskHolder holder = taskEntry.getValue(); if (holder.hasParent(parentTaskId)) { holder.cancel(reason); } } }
/** * Bans all tasks with the specified parent task from execution, cancels all tasks that are currently executing. * <p> * This method is called when a parent task that has children is cancelled. */ public void setBan(TaskId parentTaskId, String reason) { logger.trace("setting ban for the parent task {} {}", parentTaskId, reason); // Set the ban first, so the newly created tasks cannot be registered synchronized (banedParents) { if (lastDiscoveryNodes.nodeExists(parentTaskId.getNodeId())) { // Only set the ban if the node is the part of the cluster banedParents.put(parentTaskId, reason); } } // Now go through already running tasks and cancel them for (Map.Entry<Long, CancellableTaskHolder> taskEntry : cancellableTasks.entrySet()) { CancellableTaskHolder holder = taskEntry.getValue(); if (holder.hasParent(parentTaskId)) { holder.cancel(reason); } } }
/** * Bans all tasks with the specified parent task from execution, cancels all tasks that are currently executing. * <p> * This method is called when a parent task that has children is cancelled. */ public void setBan(TaskId parentTaskId, String reason) { logger.trace("setting ban for the parent task {} {}", parentTaskId, reason); // Set the ban first, so the newly created tasks cannot be registered synchronized (banedParents) { if (lastDiscoveryNodes.nodeExists(parentTaskId.getNodeId())) { // Only set the ban if the node is the part of the cluster banedParents.put(parentTaskId, reason); } } // Now go through already running tasks and cancel them for (Map.Entry<Long, CancellableTaskHolder> taskEntry : cancellableTasks.entrySet()) { CancellableTaskHolder holder = taskEntry.getValue(); if (holder.hasParent(parentTaskId)) { holder.cancel(reason); } } }