Class LocalInputChannel
- java.lang.Object
-
- org.apache.flink.runtime.io.network.partition.consumer.InputChannel
-
- org.apache.flink.runtime.io.network.partition.consumer.LocalInputChannel
-
- All Implemented Interfaces:
BufferAvailabilityListener
public class LocalInputChannel extends InputChannel implements BufferAvailabilityListener
An input channel, which requests a local subpartition.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.flink.runtime.io.network.partition.consumer.InputChannel
InputChannel.BufferAndAvailability
-
-
Field Summary
-
Fields inherited from class org.apache.flink.runtime.io.network.partition.consumer.InputChannel
channelInfo, consumedSubpartitionIndexSet, currentBackoff, initialBackoff, inputGate, maxBackoff, numBuffersIn, numBytesIn, partitionId
-
-
Constructor Summary
Constructors Constructor Description LocalInputChannel(SingleInputGate inputGate, int channelIndex, ResultPartitionID partitionId, ResultSubpartitionIndexSet consumedSubpartitionIndexSet, ResultPartitionManager partitionManager, TaskEventPublisher taskEventPublisher, int initialBackoff, int maxBackoff, org.apache.flink.metrics.Counter numBytesIn, org.apache.flink.metrics.Counter numBuffersIn, ChannelStateWriter stateWriter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacknowledgeAllRecordsProcessed()When receivedEndOfDatafrom one channel, it need to acknowledge after this event get processed.voidcheckpointStarted(CheckpointBarrier barrier)Called by task thread when checkpointing is started (e.g., any input channel received barrier).voidcheckpointStopped(long checkpointId)Called by task thread on cancel/complete to clean-up temporary data.Optional<InputChannel.BufferAndAvailability>getNextBuffer()Returns the next buffer from the consumed subpartitions orOptional.empty()if there is no data to return.voidnotifyDataAvailable(ResultSubpartitionView view)Called whenever there might be new data available.voidnotifyRequiredSegmentId(int subpartitionId, int segmentId)Notify the upstream the id of required segment that should be sent to netty connection.protected intpeekNextBufferSubpartitionIdInternal()Returns the index of the subpartition where the next buffer locates, or -1 if there is no buffer available and the subpartition to be consumed is not determined.protected voidrequestSubpartitions()voidresumeConsumption()After sending aCheckpointBarrierof exactly-once mode, the upstream will be blocked and become unavailable.StringtoString()intunsynchronizedGetNumberOfQueuedBuffers()-
Methods inherited from class org.apache.flink.runtime.io.network.partition.consumer.InputChannel
checkError, convertToPriorityEvent, getChannelIndex, getChannelInfo, getConsumedSubpartitionIndexSet, getCurrentBackoff, getPartitionId, increaseBackoff, notifyBufferAvailable, notifyChannelNonEmpty, notifyPriorityEvent, peekNextBufferSubpartitionId, setError, unsynchronizedGetSizeOfQueuedBuffers
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.flink.runtime.io.network.partition.BufferAvailabilityListener
notifyPriorityEvent
-
-
-
-
Constructor Detail
-
LocalInputChannel
public LocalInputChannel(SingleInputGate inputGate, int channelIndex, ResultPartitionID partitionId, ResultSubpartitionIndexSet consumedSubpartitionIndexSet, ResultPartitionManager partitionManager, TaskEventPublisher taskEventPublisher, int initialBackoff, int maxBackoff, org.apache.flink.metrics.Counter numBytesIn, org.apache.flink.metrics.Counter numBuffersIn, ChannelStateWriter stateWriter)
-
-
Method Detail
-
checkpointStarted
public void checkpointStarted(CheckpointBarrier barrier) throws CheckpointException
Description copied from class:InputChannelCalled by task thread when checkpointing is started (e.g., any input channel received barrier).- Overrides:
checkpointStartedin classInputChannel- Throws:
CheckpointException
-
checkpointStopped
public void checkpointStopped(long checkpointId)
Description copied from class:InputChannelCalled by task thread on cancel/complete to clean-up temporary data.- Overrides:
checkpointStoppedin classInputChannel
-
requestSubpartitions
protected void requestSubpartitions() throws IOException- Throws:
IOException
-
peekNextBufferSubpartitionIdInternal
protected int peekNextBufferSubpartitionIdInternal() throws IOExceptionDescription copied from class:InputChannelReturns the index of the subpartition where the next buffer locates, or -1 if there is no buffer available and the subpartition to be consumed is not determined.- Specified by:
peekNextBufferSubpartitionIdInternalin classInputChannel- Throws:
IOException
-
getNextBuffer
public Optional<InputChannel.BufferAndAvailability> getNextBuffer() throws IOException
Description copied from class:InputChannelReturns the next buffer from the consumed subpartitions orOptional.empty()if there is no data to return.- Specified by:
getNextBufferin classInputChannel- Throws:
IOException
-
notifyDataAvailable
public void notifyDataAvailable(ResultSubpartitionView view)
Description copied from interface:BufferAvailabilityListenerCalled whenever there might be new data available.- Specified by:
notifyDataAvailablein interfaceBufferAvailabilityListener- Parameters:
view- theResultSubpartitionViewcontaining available data.
-
resumeConsumption
public void resumeConsumption()
Description copied from class:InputChannelAfter sending aCheckpointBarrierof exactly-once mode, the upstream will be blocked and become unavailable. This method tries to unblock the corresponding upstream and resume data consumption.- Specified by:
resumeConsumptionin classInputChannel
-
acknowledgeAllRecordsProcessed
public void acknowledgeAllRecordsProcessed() throws IOExceptionDescription copied from class:InputChannelWhen receivedEndOfDatafrom one channel, it need to acknowledge after this event get processed.- Specified by:
acknowledgeAllRecordsProcessedin classInputChannel- Throws:
IOException
-
unsynchronizedGetNumberOfQueuedBuffers
public int unsynchronizedGetNumberOfQueuedBuffers()
- Overrides:
unsynchronizedGetNumberOfQueuedBuffersin classInputChannel
-
notifyRequiredSegmentId
public void notifyRequiredSegmentId(int subpartitionId, int segmentId)Description copied from class:InputChannelNotify the upstream the id of required segment that should be sent to netty connection.- Overrides:
notifyRequiredSegmentIdin classInputChannel- Parameters:
subpartitionId- The id of the corresponding subpartition.segmentId- The id of required segment.
-
-