String activityId = decisions.getActivityId(attributes);
if (decisions.handleActivityTaskCanceled(event)) {
CancellationException e = new CancellationException();
OpenRequestInfo<String, ActivityType> scheduled = scheduledActivities.remove(activityId);
if (scheduled != null) {
ExternalTaskCompletionHandle completionHandle = scheduled.getCompletionHandle();
// It is OK to fail with subclass of CancellationException when cancellation requested.
// It allows passing information about cancellation (details in this case) to the surrounding doCatch block
completionHandle.fail(e);
}
}
}