/** * Handles user cancellation. * * @param sesId Session ID. */ public void onCancelled(GridUuid sesId) { assert sesId != null; lock.readLock(); try { if (stopping && !waiting) { U.warn(log, "Attempt to cancel task while stopping grid (will ignore): " + sesId); return; } GridTaskWorker<?, ?> task = tasks.get(sesId); if (task == null) { if (log.isDebugEnabled()) log.debug("Attempt to cancel unknown task (was task already reduced?): " + sesId); return; } task.finishTask(null, new GridComputeTaskCancelledException("Task was cancelled."), true); } finally { lock.readUnlock(); } }
U.warn(log, e.getMessage()); Throwable ex = new GridComputeTaskCancelledException("Task cancelled due to stopping of the grid: " + task);