Class InputSelection
- java.lang.Object
-
- org.apache.flink.streaming.api.operators.InputSelection
-
- All Implemented Interfaces:
Serializable
@PublicEvolving public final class InputSelection extends Object implements Serializable
Describe the input selection that stream operators want to read records.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
InputSelection.Builder
Utility class for creatingInputSelection
.
-
Field Summary
Fields Modifier and Type Field Description static InputSelection
ALL
TheInputSelection
instance which indicates to select all inputs.static InputSelection
FIRST
TheInputSelection
instance which indicates to select the first input.static int
NONE_AVAILABLE
static InputSelection
SECOND
TheInputSelection
instance which indicates to select the second input.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
areAllInputsSelected()
Tests if all inputs are selected.boolean
equals(Object o)
int
fairSelectNextIndex(long availableInputsMask, int lastReadInputIndex)
Fairly select one of the available inputs for reading.static int
fairSelectNextIndex(long inputMask, long availableInputsMask, int lastReadInputIndex)
Fairly select one of the available inputs for reading.int
fairSelectNextIndexOutOf2(int availableInputsMask, int lastReadInputIndex)
Fairly select one of the two inputs for reading.static int
fairSelectNextIndexOutOf2(int selectionMask, int availableInputsMask, int lastReadInputIndex)
Fairly select one of the two inputs for reading.long
getInputMask()
boolean
isInputSelected(int inputId)
Tests if the input specified byinputId
is selected.String
toString()
-
-
-
Field Detail
-
NONE_AVAILABLE
public static final int NONE_AVAILABLE
- See Also:
- Constant Field Values
-
ALL
public static final InputSelection ALL
TheInputSelection
instance which indicates to select all inputs.
-
FIRST
public static final InputSelection FIRST
TheInputSelection
instance which indicates to select the first input.
-
SECOND
public static final InputSelection SECOND
TheInputSelection
instance which indicates to select the second input.
-
-
Method Detail
-
getInputMask
public long getInputMask()
-
isInputSelected
public boolean isInputSelected(int inputId)
Tests if the input specified byinputId
is selected.- Parameters:
inputId
- The input id, see the description ofinputId
inInputSelection.Builder.select(int)
.- Returns:
true
if the input is selected,false
otherwise.
-
areAllInputsSelected
public boolean areAllInputsSelected()
Tests if all inputs are selected.- Returns:
true
if the input mask equals -1,false
otherwise.
-
fairSelectNextIndexOutOf2
public int fairSelectNextIndexOutOf2(int availableInputsMask, int lastReadInputIndex)
Fairly select one of the two inputs for reading. WheninputMask
includes two inputs and both inputs are available, alternately select one of them. Otherwise, select the available one ofinputMask
, or returnNONE_AVAILABLE
to indicate no input is selected.Note that this supports only two inputs for performance reasons.
- Parameters:
availableInputsMask
- The mask of all available inputs.lastReadInputIndex
- The index of last read input.- Returns:
- the index of the input for reading or
NONE_AVAILABLE
(ifinputMask
is empty or the inputs ininputMask
are unavailable).
-
fairSelectNextIndexOutOf2
public static int fairSelectNextIndexOutOf2(int selectionMask, int availableInputsMask, int lastReadInputIndex)
Fairly select one of the two inputs for reading. WheninputMask
includes two inputs and both inputs are available, alternately select one of them. Otherwise, select the available one ofinputMask
, or returnNONE_AVAILABLE
to indicate no input is selected.Note that this supports only two inputs for performance reasons.
- Parameters:
selectionMask
- The mask of inputs that are selected. Note -1 for this is interpreted as all of the 32 inputs are available.availableInputsMask
- The mask of all available inputs.lastReadInputIndex
- The index of last read input.- Returns:
- the index of the input for reading or
NONE_AVAILABLE
(ifinputMask
is empty or the inputs ininputMask
are unavailable).
-
fairSelectNextIndex
public int fairSelectNextIndex(long availableInputsMask, int lastReadInputIndex)
Fairly select one of the available inputs for reading.- Parameters:
availableInputsMask
- The mask of all available inputs. Note -1 for this is interpreted as all of the 32 inputs are available.lastReadInputIndex
- The index of last read input.- Returns:
- the index of the input for reading or
NONE_AVAILABLE
(ifinputMask
is empty or the inputs ininputMask
are unavailable).
-
fairSelectNextIndex
public static int fairSelectNextIndex(long inputMask, long availableInputsMask, int lastReadInputIndex)
Fairly select one of the available inputs for reading.- Parameters:
inputMask
- The mask of inputs that are selected. Note -1 for this is interpreted as all of the 32 inputs are available.availableInputsMask
- The mask of all available inputs. Note -1 for this is interpreted as all of the 32 inputs are available.lastReadInputIndex
- The index of last read input.- Returns:
- the index of the input for reading or
NONE_AVAILABLE
(ifinputMask
is empty or the inputs ininputMask
are unavailable).
-
-