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 Details

    • RoundRobinChannelSelector

      public RoundRobinChannelSelector()
  • Method Details

    • setup

      public void setup(int numberOfChannels)
      Description copied from interface: ChannelSelector
      Initializes the channel selector with the number of output channels.
      Specified by:
      setup in interface ChannelSelector<T extends org.apache.flink.core.io.IOReadableWritable>
      Parameters:
      numberOfChannels - the total number of output channels which are attached to respective output gate.
    • selectChannel

      public int selectChannel(T record)
      Description copied from interface: ChannelSelector
      Returns 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 throwing UnsupportedOperationException).
      Specified by:
      selectChannel in interface ChannelSelector<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: ChannelSelector
      Returns whether the channel selector always selects all the output channels.
      Specified by:
      isBroadcast in interface ChannelSelector<T extends org.apache.flink.core.io.IOReadableWritable>
      Returns:
      true if the selector is for broadcast mode.