public class UnionInputGate extends InputGate
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.
InputGate.InputWithData<INPUT,DATA>
AvailabilityProvider.AvailabilityHelper
availabilityHelper
AVAILABLE
Constructor and Description |
---|
UnionInputGate(IndexedInputGate... inputGates) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
InputChannel |
getChannel(int channelIndex)
Returns the channel of this gate.
|
Optional<BufferOrEvent> |
getNext()
Blocking call waiting for next
BufferOrEvent . |
int |
getNumberOfInputChannels()
Returns the total number of input channels across all unioned input gates.
|
boolean |
isFinished() |
Optional<BufferOrEvent> |
pollNext()
Poll the
BufferOrEvent . |
CompletableFuture<?> |
readRecoveredState(ExecutorService executor,
ChannelStateReader reader)
Reads the previous unaligned checkpoint states before requesting partition data.
|
void |
registerBufferReceivedListener(BufferReceivedListener listener) |
void |
requestPartitions() |
void |
resumeConsumption(int channelIndex) |
void |
sendTaskEvent(TaskEvent event) |
void |
setup()
Setup gate, potentially heavy-weight, blocking operation comparing to just creation.
|
getAvailableFuture, getChannelInfos
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isApproximatelyAvailable, isAvailable
public UnionInputGate(IndexedInputGate... inputGates)
public int getNumberOfInputChannels()
getNumberOfInputChannels
in class InputGate
public InputChannel getChannel(int channelIndex)
InputGate
getChannel
in class InputGate
public boolean isFinished()
isFinished
in interface PullingAsyncDataInput<BufferOrEvent>
isFinished
in class InputGate
public Optional<BufferOrEvent> getNext() throws IOException, InterruptedException
InputGate
BufferOrEvent
.
Note: It should be guaranteed that the previous returned buffer has been recycled before getting next one.
getNext
in class InputGate
Optional.empty()
if InputGate.isFinished()
returns true.IOException
InterruptedException
public Optional<BufferOrEvent> pollNext() throws IOException, InterruptedException
InputGate
BufferOrEvent
.
Note: It should be guaranteed that the previous returned buffer has been recycled before polling next one.
pollNext
in interface PullingAsyncDataInput<BufferOrEvent>
pollNext
in class InputGate
Optional.empty()
if there is no data to return or if InputGate.isFinished()
returns true.IOException
InterruptedException
public void sendTaskEvent(TaskEvent event) throws IOException
sendTaskEvent
in class InputGate
IOException
public void resumeConsumption(int channelIndex) throws IOException
resumeConsumption
in class InputGate
IOException
public void setup()
InputGate
public CompletableFuture<?> readRecoveredState(ExecutorService executor, ChannelStateReader reader)
InputGate
readRecoveredState
in class InputGate
executor
- the dedicated executor for performing this action for all the internal
channels.reader
- the dedicated reader for unspilling the respective channel state from
snapshots.public void requestPartitions() throws IOException
requestPartitions
in class InputGate
IOException
public void close() throws IOException
IOException
public void registerBufferReceivedListener(BufferReceivedListener listener)
registerBufferReceivedListener
in class InputGate
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.