public class UnionInputGate extends Object implements InputGate, InputGateListener
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.
| Constructor and Description |
|---|
UnionInputGate(InputGate... inputGates) |
| Modifier and Type | Method and Description |
|---|---|
Optional<BufferOrEvent> |
getNextBufferOrEvent()
Blocking call waiting for next
BufferOrEvent. |
int |
getNumberOfInputChannels()
Returns the total number of input channels across all unioned input gates.
|
String |
getOwningTaskName() |
int |
getPageSize() |
boolean |
isFinished() |
void |
notifyInputGateNonEmpty(InputGate inputGate)
Notification callback if the input gate moves from zero to non-zero
available input channels with data.
|
Optional<BufferOrEvent> |
pollNextBufferOrEvent()
Poll the
BufferOrEvent. |
void |
registerListener(InputGateListener listener) |
void |
requestPartitions() |
void |
sendTaskEvent(TaskEvent event) |
public UnionInputGate(InputGate... inputGates)
public int getNumberOfInputChannels()
getNumberOfInputChannels in interface InputGatepublic String getOwningTaskName()
getOwningTaskName in interface InputGatepublic boolean isFinished()
isFinished in interface InputGatepublic void requestPartitions()
throws IOException,
InterruptedException
requestPartitions in interface InputGateIOExceptionInterruptedExceptionpublic Optional<BufferOrEvent> getNextBufferOrEvent() throws IOException, InterruptedException
InputGateBufferOrEvent.getNextBufferOrEvent in interface InputGateOptional.empty() if InputGate.isFinished() returns true.IOExceptionInterruptedExceptionpublic Optional<BufferOrEvent> pollNextBufferOrEvent() throws UnsupportedOperationException
InputGateBufferOrEvent.pollNextBufferOrEvent in interface InputGateOptional.empty() if there is no data to return or if InputGate.isFinished() returns true.UnsupportedOperationExceptionpublic void sendTaskEvent(TaskEvent event) throws IOException
sendTaskEvent in interface InputGateIOExceptionpublic void registerListener(InputGateListener listener)
registerListener in interface InputGatepublic int getPageSize()
getPageSize in interface InputGatepublic void notifyInputGateNonEmpty(InputGate inputGate)
InputGateListenernotifyInputGateNonEmpty in interface InputGateListenerinputGate - Input Gate that became available.Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.