Class UnionInputGate
- All Implemented Interfaces:
AutoCloseable,AvailabilityProvider,ChannelStateHolder,PullingAsyncDataInput<BufferOrEvent>
Each input gate has input channels attached from which it reads data. At each input gate, the input channels have unique IDs from 0 (inclusive) to the number of input channels (exclusive).
+---+---+ +---+---+---+ | 0 | 1 | | 0 | 1 | 2 | +--------------+--------------+ | Input gate 0 | Input gate 1 | +--------------+--------------+
The union input gate maps these IDs from 0 to the *total* number of input channels across all unioned input gates, e.g. the channels of input gate 0 keep their original indexes and the channel indexes of input gate 1 are set off by 2 to 2--4.
+---+---++---+---+---+ | 0 | 1 || 2 | 3 | 4 | +--------------------+ | Union input gate | +--------------------+It is NOT possible to recursively union union input gates.
-
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidacknowledgeAllRecordsProcessed(InputChannelInfo channelInfo) voidclose()voidgetChannel(int channelIndex) Returns the channel of this gate.getNext()Blocking call waiting for nextBufferOrEvent.intReturns the total number of input channels across all unioned input gates.Tells if we consumed all available data.booleanpollNext()Poll theBufferOrEvent.voidvoidresumeConsumption(InputChannelInfo channelInfo) voidvoidsendTaskEvent(TaskEvent event) voidsetup()Setup gate, potentially heavy-weight, blocking operation comparing to just creation.toString()Methods inherited from class org.apache.flink.runtime.io.network.partition.consumer.InputGate
getAvailableFuture, getChannelInfos, getPriorityEventAvailableFuture, setChannelStateWriterMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.flink.runtime.io.AvailabilityProvider
isApproximatelyAvailable, isAvailable
-
Constructor Details
-
UnionInputGate
-
-
Method Details
-
getNumberOfInputChannels
public int getNumberOfInputChannels()Returns the total number of input channels across all unioned input gates.- Specified by:
getNumberOfInputChannelsin classInputGate
-
getChannel
Description copied from class:InputGateReturns the channel of this gate.- Specified by:
getChannelin classInputGate
-
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. -
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
-
resumeGateConsumption
- Specified by:
resumeGateConsumptionin classInputGate- Throws:
IOException
-
resumeConsumption
- Specified by:
resumeConsumptionin classInputGate- Throws:
IOException
-
acknowledgeAllRecordsProcessed
- Specified by:
acknowledgeAllRecordsProcessedin classInputGate- Throws:
IOException
-
setup
public void setup()Description copied from class:InputGateSetup gate, potentially heavy-weight, blocking operation comparing to just creation. -
getStateConsumedFuture
- Specified by:
getStateConsumedFuturein classInputGate
-
requestPartitions
- Specified by:
requestPartitionsin classInputGate- Throws:
IOException
-
close
- Throws:
IOException
-
toString
-
finishReadRecoveredState
- Specified by:
finishReadRecoveredStatein classInputGate- Throws:
IOException
-