Class RoundRobinChannelSelector<T extends org.apache.flink.core.io.IOReadableWritable>
java.lang.Object
org.apache.flink.runtime.io.network.api.writer.RoundRobinChannelSelector<T>
- Type Parameters:
T- the type of record which is sent through the attached output gate
- All Implemented Interfaces:
ChannelSelector<T>
public class RoundRobinChannelSelector<T extends org.apache.flink.core.io.IOReadableWritable>
extends Object
implements ChannelSelector<T>
This is the default implementation of the
ChannelSelector interface. It represents a
simple round-robin strategy, i.e. regardless of the record every attached exactly one output
channel is selected at a time.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether the channel selector always selects all the output channels.intselectChannel(T record) Returns the logical channel index, to which the given record should be written.voidsetup(int numberOfChannels) Initializes the channel selector with the number of output channels.
-
Constructor Details
-
RoundRobinChannelSelector
public RoundRobinChannelSelector()
-
-
Method Details
-
setup
public void setup(int numberOfChannels) Description copied from interface:ChannelSelectorInitializes the channel selector with the number of output channels.- Specified by:
setupin interfaceChannelSelector<T extends org.apache.flink.core.io.IOReadableWritable>- Parameters:
numberOfChannels- the total number of output channels which are attached to respective output gate.
-
selectChannel
Description copied from interface:ChannelSelectorReturns the logical channel index, to which the given record should be written. It is illegal to call this method for broadcast channel selectors and this method can remain not implemented in that case (for example by throwingUnsupportedOperationException).- Specified by:
selectChannelin interfaceChannelSelector<T extends org.apache.flink.core.io.IOReadableWritable>- Parameters:
record- the record to determine the output channels for.- Returns:
- an integer number which indicates the index of the output channel through which the record shall be forwarded.
-
isBroadcast
public boolean isBroadcast()Description copied from interface:ChannelSelectorReturns whether the channel selector always selects all the output channels.- Specified by:
isBroadcastin interfaceChannelSelector<T extends org.apache.flink.core.io.IOReadableWritable>- Returns:
- true if the selector is for broadcast mode.
-