Class RoundRobinConnectionDistributor

  • All Implemented Interfaces:
    NIOChannelDistributor

    public final class RoundRobinConnectionDistributor
    extends AbstractNIOConnectionDistributor
    RoundRobin NIOConnectionDistributor implementation, which allocates one SelectorRunner for OP_ACCEPT events and other event will be assign to a next SelectorRunner from the array.
    Author:
    Alexey Stashok
    • Constructor Detail

      • RoundRobinConnectionDistributor

        public RoundRobinConnectionDistributor​(NIOTransport transport)
      • RoundRobinConnectionDistributor

        public RoundRobinConnectionDistributor​(NIOTransport transport,
                                               boolean useDedicatedAcceptor)
      • RoundRobinConnectionDistributor

        public RoundRobinConnectionDistributor​(NIOTransport transport,
                                               boolean useDedicatedAcceptor,
                                               boolean isServerOnly)
        Constructs RoundRobinConnectionDistributor with the given configuration.
        Parameters:
        transport -
        useDedicatedAcceptor - depending on this flag server Connections, responsible for accepting client connections, will or will not use dedicated SelectorRunner
        isServerOnly - true means this NIOChannelDistributor will be used by a Transport, which operates as a server only(the Transport will never initiate a client-side Connection). In this case we're able to use optimized (thread unsafe) distribution algorithm.
    • Method Detail

      • registerChannel

        public void registerChannel​(java.nio.channels.SelectableChannel channel,
                                    int interestOps,
                                    java.lang.Object attachment)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • registerChannelAsync

        public void registerChannelAsync​(java.nio.channels.SelectableChannel channel,
                                         int interestOps,
                                         java.lang.Object attachment,
                                         CompletionHandler<RegisterChannelResult> completionHandler)
      • registerServiceChannelAsync

        public void registerServiceChannelAsync​(java.nio.channels.SelectableChannel channel,
                                                int interestOps,
                                                java.lang.Object attachment,
                                                CompletionHandler<RegisterChannelResult> completionHandler)