Class InputGateWithMetrics
java.lang.Object
org.apache.flink.runtime.io.network.partition.consumer.InputGate
org.apache.flink.runtime.io.network.partition.consumer.IndexedInputGate
org.apache.flink.runtime.taskmanager.InputGateWithMetrics
- All Implemented Interfaces:
AutoCloseable,AvailabilityProvider,ChannelStateHolder,CheckpointableInput,PullingAsyncDataInput<BufferOrEvent>
This class wraps
InputGate provided by shuffle service and it is mainly used for
increasing general input metrics from TaskIOMetricGroup.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.flink.runtime.io.network.partition.consumer.InputGate
InputGate.InputWithData<INPUT,DATA> Nested classes/interfaces inherited from interface org.apache.flink.runtime.io.AvailabilityProvider
AvailabilityProvider.AvailabilityHelperNested classes/interfaces inherited from interface org.apache.flink.runtime.io.PullingAsyncDataInput
PullingAsyncDataInput.EndOfDataStatus -
Field Summary
Fields inherited from class org.apache.flink.runtime.io.network.partition.consumer.InputGate
availabilityHelper, priorityAvailabilityHelperFields inherited from interface org.apache.flink.runtime.io.AvailabilityProvider
AVAILABLE -
Constructor Summary
ConstructorsConstructorDescriptionInputGateWithMetrics(IndexedInputGate inputGate, org.apache.flink.metrics.Counter numBytesIn) -
Method Summary
Modifier and TypeMethodDescriptionvoidacknowledgeAllRecordsProcessed(InputChannelInfo channelInfo) voidclose()voidgetChannel(int channelIndex) Returns the channel of this gate.intReturns the index of this input gate.getNext()Blocking call waiting for nextBufferOrEvent.intNotifies when a priority event has been enqueued.Returns the list of channels that have not received EndOfPartitionEvent.Tells if we consumed all available data.booleanpollNext()Poll theBufferOrEvent.voidvoidresumeConsumption(InputChannelInfo channelInfo) voidvoidsendTaskEvent(TaskEvent event) voidsetChannelStateWriter(ChannelStateWriter channelStateWriter) Injects theChannelStateWriter.voidsetup()Setup gate, potentially heavy-weight, blocking operation comparing to just creation.voidMethods inherited from class org.apache.flink.runtime.io.network.partition.consumer.IndexedInputGate
blockConsumption, checkpointStarted, checkpointStopped, convertToPriorityEvent, getInputGateIndexMethods inherited from class org.apache.flink.runtime.io.network.partition.consumer.InputGate
getChannelInfosMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.flink.runtime.io.AvailabilityProvider
isApproximatelyAvailable, isAvailableMethods inherited from interface org.apache.flink.runtime.io.network.partition.consumer.CheckpointableInput
getChannelInfos
-
Constructor Details
-
InputGateWithMetrics
public InputGateWithMetrics(IndexedInputGate inputGate, org.apache.flink.metrics.Counter numBytesIn)
-
-
Method Details
-
getAvailableFuture
- Specified by:
getAvailableFuturein interfaceAvailabilityProvider- Overrides:
getAvailableFuturein classInputGate- Returns:
- a future that is completed if there are more records available. If there are more
records available immediately,
AvailabilityProvider.AVAILABLEshould be returned. Previously returned not completed futures should become completed once there are more records available.
-
resumeGateConsumption
- Specified by:
resumeGateConsumptionin classInputGate- Throws:
IOException
-
resumeConsumption
- Specified by:
resumeConsumptionin interfaceCheckpointableInput- Specified by:
resumeConsumptionin classInputGate- Throws:
IOException
-
acknowledgeAllRecordsProcessed
- Specified by:
acknowledgeAllRecordsProcessedin classInputGate- Throws:
IOException
-
getNumberOfInputChannels
public int getNumberOfInputChannels()- Specified by:
getNumberOfInputChannelsin interfaceCheckpointableInput- Specified by:
getNumberOfInputChannelsin classInputGate
-
getChannel
Description copied from class:InputGateReturns the channel of this gate.- Specified by:
getChannelin classInputGate
-
getGateIndex
public int getGateIndex()Description copied from class:IndexedInputGateReturns the index of this input gate. Only supported on- Specified by:
getGateIndexin classIndexedInputGate
-
getUnfinishedChannels
Description copied from class:IndexedInputGateReturns the list of channels that have not received EndOfPartitionEvent.- Specified by:
getUnfinishedChannelsin classIndexedInputGate
-
triggerDebloating
public void triggerDebloating()- Specified by:
triggerDebloatingin classIndexedInputGate
-
isFinished
public boolean isFinished()- Specified by:
isFinishedin interfacePullingAsyncDataInput<BufferOrEvent>- Specified by:
isFinishedin classInputGate- Returns:
- true if is finished and for example end of input was reached, false otherwise.
-
hasReceivedEndOfData
Description copied from interface:PullingAsyncDataInputTells if we consumed all available data.Moreover it tells us the reason why there is no more data incoming. If any of the upstream subtasks finished because of the stop-with-savepoint --no-drain, we should not drain the input. See also
StopMode. -
setup
Description copied from class:InputGateSetup gate, potentially heavy-weight, blocking operation comparing to just creation.- Specified by:
setupin classInputGate- Throws:
IOException
-
getStateConsumedFuture
- Specified by:
getStateConsumedFuturein classInputGate
-
requestPartitions
- Specified by:
requestPartitionsin classInputGate- Throws:
IOException
-
setChannelStateWriter
Description copied from interface:ChannelStateHolderInjects theChannelStateWriter. Must only be called once.- Specified by:
setChannelStateWriterin interfaceChannelStateHolder- Overrides:
setChannelStateWriterin classInputGate
-
getNext
Description copied from class:InputGateBlocking call waiting for nextBufferOrEvent.Note: It should be guaranteed that the previous returned buffer has been recycled before getting next one.
- Specified by:
getNextin classInputGate- Returns:
Optional.empty()ifInputGate.isFinished()returns true.- Throws:
IOExceptionInterruptedException
-
pollNext
Description copied from class:InputGatePoll theBufferOrEvent.Note: It should be guaranteed that the previous returned buffer has been recycled before polling next one.
- Specified by:
pollNextin interfacePullingAsyncDataInput<BufferOrEvent>- Specified by:
pollNextin classInputGate- Returns:
Optional.empty()if there is no data to return or ifInputGate.isFinished()returns true.- Throws:
IOExceptionInterruptedException
-
sendTaskEvent
- Specified by:
sendTaskEventin classInputGate- Throws:
IOException
-
close
- Throws:
Exception
-
getPriorityEventAvailableFuture
Description copied from class:InputGateNotifies when a priority event has been enqueued. If this future is queried from task thread, it is guaranteed that a priority event is available and retrieved throughInputGate.getNext().- Overrides:
getPriorityEventAvailableFuturein classInputGate
-
finishReadRecoveredState
- Specified by:
finishReadRecoveredStatein classInputGate- Throws:
IOException
-