public static NodeOperation withDownstream( ExecutionPhase executionPhase, ExecutionPhase downstreamExecutionPhase, byte inputId, String localNodeId) { if (downstreamExecutionPhase.executionNodes().isEmpty()) { if (executionPhase instanceof UpstreamPhase && executionPhase.executionNodes().size() == 1 && executionPhase.executionNodes().contains(localNodeId)) { ((UpstreamPhase) executionPhase).distributionType(DistributionType.SAME_NODE); LOGGER.trace( "Phase uses SAME_NODE downstream, reason: ON HANDLER, executionNodes: {}, phase: {}", executionPhase.executionNodes(), executionPhase); return new NodeOperation( executionPhase, ImmutableList.<String>of(), downstreamExecutionPhase.executionPhaseId(), inputId); } return new NodeOperation( executionPhase, ImmutableList.of(ExecutionPhase.DIRECT_RETURN_DOWNSTREAM_NODE), downstreamExecutionPhase.executionPhaseId(), inputId); } else { if (executionPhase instanceof UpstreamPhase) { if (executionPhase.executionNodes().size() == 1 && executionPhase.executionNodes().equals(downstreamExecutionPhase.executionNodes())) { ((UpstreamPhase) executionPhase).distributionType(DistributionType.SAME_NODE); LOGGER.trace( "Phase uses SAME_NODE downstream, reason: ON DOWNSTRREAM NODE, executionNodes: {}, phase: {}", executionPhase.executionNodes(), executionPhase); } } return new NodeOperation( executionPhase, downstreamExecutionPhase.executionNodes(), downstreamExecutionPhase.executionPhaseId(), inputId); } }
@Override public String toString() { return "NodeOp{ " + executionPhase.executionPhaseId() + " " + executionPhase.name() + ", downstreamNodes=" + downstreamNodes + ", downstreamPhase=" + downstreamExecutionPhaseId + ", downstreamInputId=" + downstreamExecutionPhaseInputId + '}'; }