private static void consumeSkipFlows( ExecutionTask task, Map<String, String> copyDefinitions, BatchScript script) { assert task != null; assert copyDefinitions != null; assert script != null; String flows = copyDefinitions.remove(KEY_SKIP_FLOWS); if (flows == null || flows.trim().isEmpty()) { return; } LOG.debug("Definition: {}={}", KEY_SKIP_FLOWS, flows); for (String flowIdCandidate : flows.split(",")) { String flowId = flowIdCandidate.trim(); if (flowId.isEmpty() == false) { FlowScript flow = script.findFlow(flowId); if (flow == null) { throw new IllegalArgumentException(MessageFormat.format( "Unknown flowId in definition {0} : {1}", KEY_SKIP_FLOWS, flowId)); } task.skipFlows.add(flowId); } } }
throw new IllegalArgumentException("executionId must not be null"); //$NON-NLS-1$ FlowScript flow = script.findFlow(flowId); if (flow == null) { throw new IllegalArgumentException(MessageFormat.format(
/** * Executes a target phase. * @param context the current context * @throws InterruptedException if interrupted during this execution * @throws IOException if failed to execute target phase * @throws IllegalArgumentException if some parameters were {@code null} * @since 0.2.5 */ public void executePhase(ExecutionContext context) throws InterruptedException, IOException { if (context == null) { throw new IllegalArgumentException("context must not be null"); //$NON-NLS-1$ } FlowScript flow = script.findFlow(context.getFlowId()); if (flow == null) { throw new IllegalArgumentException(MessageFormat.format( "Flow is undefined: batchId={0}, flowId={1}, executionId={2}", context.getBatchId(), context.getFlowId(), context.getExecutionId())); } Set<ExecutionScript> executions = flow.getScripts().get(context.getPhase()); try (ExecutionLock lock = acquireExecutionLock(context.getBatchId())) { lock.beginFlow(context.getFlowId(), context.getExecutionId()); executePhase(context, executions, flow.getEnabledScriptKinds()); lock.endFlow(context.getFlowId(), context.getExecutionId()); } }