Package org.glassfish.grizzly.nio
Class RoundRobinConnectionDistributor
- java.lang.Object
-
- org.glassfish.grizzly.nio.AbstractNIOConnectionDistributor
-
- org.glassfish.grizzly.nio.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
-
-
Field Summary
-
Fields inherited from class org.glassfish.grizzly.nio.AbstractNIOConnectionDistributor
transport
-
-
Constructor Summary
Constructors Constructor Description RoundRobinConnectionDistributor(NIOTransport transport)
RoundRobinConnectionDistributor(NIOTransport transport, boolean useDedicatedAcceptor)
RoundRobinConnectionDistributor(NIOTransport transport, boolean useDedicatedAcceptor, boolean isServerOnly)
Constructs RoundRobinConnectionDistributor with the given configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
registerChannel(SelectableChannel channel, int interestOps, Object attachment)
void
registerChannelAsync(SelectableChannel channel, int interestOps, Object attachment, CompletionHandler<RegisterChannelResult> completionHandler)
void
registerServiceChannelAsync(SelectableChannel channel, int interestOps, Object attachment, CompletionHandler<RegisterChannelResult> completionHandler)
-
Methods inherited from class org.glassfish.grizzly.nio.AbstractNIOConnectionDistributor
getTransportSelectorRunners, registerChannel, registerChannel, registerChannelAsync, registerChannelAsync, registerChannelAsync
-
-
-
-
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 serverConnection
s, responsible for accepting client connections, will or will not use dedicatedSelectorRunner
isServerOnly
- true means thisNIOChannelDistributor
will be used by aTransport
, which operates as a server only(the Transport will never initiate a client-sideConnection
). In this case we're able to use optimized (thread unsafe) distribution algorithm.
-
-
Method Detail
-
registerChannel
public void registerChannel(SelectableChannel channel, int interestOps, Object attachment) throws IOException
- Throws:
IOException
-
registerChannelAsync
public void registerChannelAsync(SelectableChannel channel, int interestOps, Object attachment, CompletionHandler<RegisterChannelResult> completionHandler)
-
registerServiceChannelAsync
public void registerServiceChannelAsync(SelectableChannel channel, int interestOps, Object attachment, CompletionHandler<RegisterChannelResult> completionHandler)
-
-