@Override protected void done() { // for calling taskDone for cancelled tasks super.done(); if (taskDoneCallback != null) { taskDoneCallback.taskDone(this); } if (taskListener != null && isCancelled()) { try { if (isContextualCallback) { setupContext(); } taskListener.taskDone(this, executor.getExecutorForTaskListener(), task, new CancellationException()); } finally { if (isContextualCallback) { resetContext(); } } } }