}
}
}
void handleActivityTaskFailed(HistoryEvent event) {
ActivityTaskFailedEventAttributes attributes = event.getActivityTaskFailedEventAttributes();
String activityId = decisions.getActivityId(attributes);
if (decisions.handleActivityTaskClosed(activityId)) {
OpenRequestInfo<String, ActivityType> scheduled = scheduledActivities.remove(activityId);
if (scheduled != null) {
String reason = attributes.getReason();
String details = attributes.getDetails();
ActivityTaskFailedException failure = new ActivityTaskFailedException(event.getEventId(),
scheduled.getUserContext(), activityId, reason, details);
ExternalTaskCompletionHandle completionHandle = scheduled.getCompletionHandle();
completionHandle.fail(failure);
}