public ChannelInstance getChannelInstance(Channel channel, boolean isPeekingToNextTransition) { final ExecutionStageLoop loop = getExecutionStageLoop(channel); if (loop == null) { return this.channelInstances.get(channel); } else { final ExecutionStageLoopContext loopContext = this.getOrCreateLoopContext(loop); return loopContext.getChannelInstance(channel, isPeekingToNextTransition); } }
@Override public void register(ChannelInstance channelInstance) { final ExecutionStageLoop loop = getExecutionStageLoop(channelInstance.getChannel()); if (loop == null) { final ChannelInstance oldChannelInstance = this.channelInstances.put(channelInstance.getChannel(), channelInstance); channelInstance.noteObtainedReference(); if (oldChannelInstance != null) { oldChannelInstance.noteDiscardedReference(true); } } else { final ExecutionStageLoopContext loopContext = this.getOrCreateLoopContext(loop); loopContext.register(channelInstance); } }