/** * Tells whether this instance is in a {@link ExecutionStageLoop} that has finished iterating. * * @return whether this instance is in a finished {@link ExecutionStageLoop} * @see #isLoopHead() */ public boolean isInFinishedLoop() { if (this.executionStageLoop == null) { return false; } final LoopHeadOperator loopHeadOperator = (LoopHeadOperator) this.executionStageLoop.getLoopHead().getLoopHeadTask().getOperator(); return loopHeadOperator.getState() == LoopHeadOperator.State.FINISHED; }
/** * Try to satisfy the input {@link ChannelInstance} requirements by updating {@link #inputChannelInstances}. * * @return whether the activation is possible */ boolean updateInputChannelInstances() { boolean isMiscChannelsReady = this.updateChannelInstances(this.miscInboundChannels, false); boolean isLoopChannelsReady = true; if (this.stage.isLoopHead()) { LoopHeadOperator loopOperator = (LoopHeadOperator) this.stage.getLoopHeadTask().getOperator(); switch (loopOperator.getState()) { case NOT_STARTED: isLoopChannelsReady = this.updateChannelInstances(this.initializationInboundChannels, false); break; case RUNNING: isLoopChannelsReady = this.updateChannelInstances(this.iterationInboundChannels, true); break; default: logger.warn("Tried to update input channel instances for finished {}.", this.stage); isLoopChannelsReady = false; } } return isMiscChannelsReady && isLoopChannelsReady; }