private void activateSuccessorTasks(ExecutionTask task, Collection<ChannelInstance> outputChannelInstances) { for (ChannelInstance outputChannelInstance : outputChannelInstances) { if (outputChannelInstance == null) continue; // Partial results possible (cf. LoopHeadOperator). final Channel channel = outputChannelInstance.getChannel(); for (ExecutionTask consumer : channel.getConsumers()) { // Stay within ExecutionStage. if (consumer.getStage() != task.getStage() || consumer.getOperator().isLoopHead()) continue; // Get or create the TaskActivator. final TaskActivator consumerActivator = this.stagedActivators.computeIfAbsent( consumer, (key) -> new TaskActivator(key, this.fetchOperatorContext(key), this.executionState) ); // Register the outputChannelInstance. consumerActivator.accept(outputChannelInstance); // Schedule the consumerActivator if it isReady. if (consumerActivator.isReady()) { this.stagedActivators.remove(consumer); this.readyActivators.add(consumerActivator); } } } }
/** * Accept input {@link ChannelInstance}s from the given {@link ExecutionState}. * * @param executionState provides {@link ChannelInstance}s */ private void acceptFrom(ExecutionState executionState) { for (int inputIndex = 0; inputIndex < this.task.getNumInputChannels(); inputIndex++) { final Channel channel = this.task.getInputChannel(inputIndex); final ChannelInstance channelInstance = executionState.getChannelInstance(channel); if (channelInstance != null) { this.accept(channelInstance); } } }