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, Counter numBytesIn, Counter numBuffersIn, ChannelStateWriter stateWriter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acknowledgeAllRecordsProcessed()
When receivedEndOfData
from one channel, it need to acknowledge after this event get processed.void
checkpointStarted(CheckpointBarrier barrier)
Called by task thread when checkpointing is started (e.g., any input channel received barrier).void
checkpointStopped(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.void
notifyDataAvailable(ResultSubpartitionView view)
Called whenever there might be new data available.void
notifyRequiredSegmentId(int subpartitionId, int segmentId)
Notify the upstream the id of required segment that should be sent to netty connection.protected int
peekNextBufferSubpartitionIdInternal()
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 void
requestSubpartitions()
void
resumeConsumption()
After sending aCheckpointBarrier
of exactly-once mode, the upstream will be blocked and become unavailable.String
toString()
int
unsynchronizedGetNumberOfQueuedBuffers()
-
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, Counter numBytesIn, Counter numBuffersIn, ChannelStateWriter stateWriter)
-
-
Method Detail
-
checkpointStarted
public void checkpointStarted(CheckpointBarrier barrier) throws CheckpointException
Description copied from class:InputChannel
Called by task thread when checkpointing is started (e.g., any input channel received barrier).- Overrides:
checkpointStarted
in classInputChannel
- Throws:
CheckpointException
-
checkpointStopped
public void checkpointStopped(long checkpointId)
Description copied from class:InputChannel
Called by task thread on cancel/complete to clean-up temporary data.- Overrides:
checkpointStopped
in classInputChannel
-
requestSubpartitions
protected void requestSubpartitions() throws IOException
- Throws:
IOException
-
peekNextBufferSubpartitionIdInternal
protected int peekNextBufferSubpartitionIdInternal() throws IOException
Description copied from class:InputChannel
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.- Specified by:
peekNextBufferSubpartitionIdInternal
in classInputChannel
- Throws:
IOException
-
getNextBuffer
public Optional<InputChannel.BufferAndAvailability> getNextBuffer() throws IOException
Description copied from class:InputChannel
Returns the next buffer from the consumed subpartitions orOptional.empty()
if there is no data to return.- Specified by:
getNextBuffer
in classInputChannel
- Throws:
IOException
-
notifyDataAvailable
public void notifyDataAvailable(ResultSubpartitionView view)
Description copied from interface:BufferAvailabilityListener
Called whenever there might be new data available.- Specified by:
notifyDataAvailable
in interfaceBufferAvailabilityListener
- Parameters:
view
- theResultSubpartitionView
containing available data.
-
resumeConsumption
public void resumeConsumption()
Description copied from class:InputChannel
After sending aCheckpointBarrier
of 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:
resumeConsumption
in classInputChannel
-
acknowledgeAllRecordsProcessed
public void acknowledgeAllRecordsProcessed() throws IOException
Description copied from class:InputChannel
When receivedEndOfData
from one channel, it need to acknowledge after this event get processed.- Specified by:
acknowledgeAllRecordsProcessed
in classInputChannel
- Throws:
IOException
-
unsynchronizedGetNumberOfQueuedBuffers
public int unsynchronizedGetNumberOfQueuedBuffers()
- Overrides:
unsynchronizedGetNumberOfQueuedBuffers
in classInputChannel
-
notifyRequiredSegmentId
public void notifyRequiredSegmentId(int subpartitionId, int segmentId)
Description copied from class:InputChannel
Notify the upstream the id of required segment that should be sent to netty connection.- Overrides:
notifyRequiredSegmentId
in classInputChannel
- Parameters:
subpartitionId
- The id of the corresponding subpartition.segmentId
- The id of required segment.
-
-