Source:
<code>private void EndCommandAction() { EntityMultiAsyncTasks entityInfo = GetEntityMultiAsyncTasks(); VdcReturnValueBase vdcReturnValue = null; AsyncTasks dbAsyncTask = getParameters().getDbAsyncTask(); ArrayList<VdcActionParametersBase> imagesParameters = new ArrayList<VdcActionParametersBase>(); for (EndedTaskInfo taskInfo : entityInfo.getEndedTasksInfo().getTasksInfo()) { VdcActionParametersBase childTaskParameters = taskInfo.getTaskParameters().getDbAsyncTask().getTaskParameters(); boolean childTaskGroupSuccess = childTaskParameters.getTaskGroupSuccess() && taskInfo.getTaskStatus().getTaskEndedSuccessfully(); childTaskParameters .setTaskGroupSuccess(childTaskGroupSuccess); if (!childTaskParameters.equals(dbAsyncTask.getActionParameters())) { imagesParameters.add(childTaskParameters); } } dbAsyncTask.getActionParameters().setImagesParameters(imagesParameters); try { log.infoFormat("EntityAsyncTask::EndCommandAction [within thread] context: Attempting to EndAction '{0}', executionIndex: '{1}'", entityInfo.getActionType(), dbAsyncTask.getActionParameters().getExecutionIndex()); try { NGuid stepId = dbAsyncTask.getStepId(); vdcReturnValue = callback.endAction(stepId, entityInfo.getActionType(), dbAsyncTask.getActionParameters() ); } catch (RuntimeException ex) { log.error(getErrorMessage(entityInfo)); log.error(ex.toString()); log.debug(ex); } } catch (RuntimeException Ex2) { log.error( "EntityAsyncTask::EndCommandAction [within thread]: An exception has been thrown (not related to 'EndAction' itself)", Ex2); } finally { <START> handleEndActionResult(taskHelper, entityInfo, vdcReturnValue, dbAsyncTask); <END> _endActionsInProgress.decrementAndGet(); } }</code><technical_language>Roy's idea of interceptor - -we consider intercepting Backend.endAction end job in order cleaner code</technical_language>

Target:
private void EndCommandAction() { EntityMultiAsyncTasks entityInfo = getEntityMultiAsyncTasks(); VdcReturnValueBase vdcReturnValue = null; AsyncTasks dbAsyncTask = getParameters().getDbAsyncTask(); ArrayList<VdcActionParametersBase> imagesParameters = new ArrayList<VdcActionParametersBase>(); for (EndedTaskInfo taskInfo : entityInfo.getEndedTasksInfo().getTasksInfo()) { VdcActionParametersBase childTaskParameters = taskInfo.getTaskParameters().getDbAsyncTask().getTaskParameters(); boolean childTaskGroupSuccess = childTaskParameters.getTaskGroupSuccess() && taskInfo.getTaskStatus().getTaskEndedSuccessfully(); childTaskParameters .setTaskGroupSuccess(childTaskGroupSuccess); if (!childTaskParameters.equals(dbAsyncTask.getActionParameters())) { imagesParameters.add(childTaskParameters); } } dbAsyncTask.getActionParameters().setImagesParameters(imagesParameters); try { log.infoFormat("EntityAsyncTask::EndCommandAction [within thread] context: Attempting to EndAction '{0}', executionIndex: '{1}'", entityInfo.getActionType(), dbAsyncTask.getActionParameters().getExecutionIndex()); try { NGuid stepId = dbAsyncTask.getStepId(); vdcReturnValue = callback.endAction(stepId, entityInfo.getActionType(), dbAsyncTask ); } catch (RuntimeException ex) { log.error(getErrorMessage(entityInfo)); log.error(ex.toString()); log.debug(ex); } } catch (RuntimeException Ex2) { log.error( "EntityAsyncTask::EndCommandAction [within thread]: An exception has been thrown (not related to 'EndAction' itself)", Ex2); } finally { _endActionsInProgress.decrementAndGet(); } }