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 classInputSelection.BuilderUtility class for creatingInputSelection.
-
Field Summary
Fields Modifier and Type Field Description static InputSelectionALLTheInputSelectioninstance which indicates to select all inputs.static InputSelectionFIRSTTheInputSelectioninstance which indicates to select the first input.static intNONE_AVAILABLEstatic InputSelectionSECONDTheInputSelectioninstance which indicates to select the second input.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanareAllInputsSelected()Tests if all inputs are selected.booleanequals(Object o)intfairSelectNextIndex(long availableInputsMask, int lastReadInputIndex)Fairly select one of the available inputs for reading.static intfairSelectNextIndex(long inputMask, long availableInputsMask, int lastReadInputIndex)Fairly select one of the available inputs for reading.intfairSelectNextIndexOutOf2(int availableInputsMask, int lastReadInputIndex)Fairly select one of the two inputs for reading.static intfairSelectNextIndexOutOf2(int selectionMask, int availableInputsMask, int lastReadInputIndex)Fairly select one of the two inputs for reading.longgetInputMask()booleanisInputSelected(int inputId)Tests if the input specified byinputIdis selected.StringtoString()
-
-
-
Field Detail
-
NONE_AVAILABLE
public static final int NONE_AVAILABLE
- See Also:
- Constant Field Values
-
ALL
public static final InputSelection ALL
TheInputSelectioninstance which indicates to select all inputs.
-
FIRST
public static final InputSelection FIRST
TheInputSelectioninstance which indicates to select the first input.
-
SECOND
public static final InputSelection SECOND
TheInputSelectioninstance which indicates to select the second input.
-
-
Method Detail
-
getInputMask
public long getInputMask()
-
isInputSelected
public boolean isInputSelected(int inputId)
Tests if the input specified byinputIdis selected.- Parameters:
inputId- The input id, see the description ofinputIdinInputSelection.Builder.select(int).- Returns:
trueif the input is selected,falseotherwise.
-
areAllInputsSelected
public boolean areAllInputsSelected()
Tests if all inputs are selected.- Returns:
trueif the input mask equals -1,falseotherwise.
-
fairSelectNextIndexOutOf2
public int fairSelectNextIndexOutOf2(int availableInputsMask, int lastReadInputIndex)Fairly select one of the two inputs for reading. WheninputMaskincludes two inputs and both inputs are available, alternately select one of them. Otherwise, select the available one ofinputMask, or returnNONE_AVAILABLEto 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(ifinputMaskis empty or the inputs ininputMaskare unavailable).
-
fairSelectNextIndexOutOf2
public static int fairSelectNextIndexOutOf2(int selectionMask, int availableInputsMask, int lastReadInputIndex)Fairly select one of the two inputs for reading. WheninputMaskincludes two inputs and both inputs are available, alternately select one of them. Otherwise, select the available one ofinputMask, or returnNONE_AVAILABLEto 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(ifinputMaskis empty or the inputs ininputMaskare 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(ifinputMaskis empty or the inputs ininputMaskare 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(ifinputMaskis empty or the inputs ininputMaskare unavailable).
-
-