Top Description Inners Fields Constructors Methods
org.glassfish.grizzly.nio

public final Class RoundRobinConnectionDistributor

extends AbstractNIOConnectionDistributor
Class Inheritance
Imports
java.io.IOException, java.nio.channels.SelectableChannel, java.util.concurrent.atomic.AtomicInteger, org.glassfish.grizzly.CompletionHandler, .Connection, .Transport

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

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
private static interface
private class
private class
private class

Field Summary

Modifier and TypeField and Description
private final RoundRobinConnectionDistributor.Iterator
Inherited from org.glassfish.grizzly.nio.AbstractNIOConnectionDistributor:
transport

Constructor Summary

AccessConstructor and Description
public
public
RoundRobinConnectionDistributor(final NIOTransport transport, final boolean useDedicatedAcceptor)

public
RoundRobinConnectionDistributor(final NIOTransport transport, final boolean
depending on this flag server Connections, responsible for accepting client connections, will or will not use dedicated SelectorRunner
useDedicatedAcceptor
,
final boolean
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.
isServerOnly
)

Constructs RoundRobinConnectionDistributor with the given configuration.

Method Summary

Modifier and TypeMethod and Description
public void
registerChannel(final SelectableChannel channel, final int interestOps, final Object attachment)

Implements org.glassfish.grizzly.nio.NIOChannelDistributor.registerChannel.

public void
public void
Inherited from org.glassfish.grizzly.nio.AbstractNIOConnectionDistributor:
getTransportSelectorRunnersregisterChannelregisterChannelregisterChannelAsyncregisterChannelAsyncregisterChannelAsync

Field Detail

itback to summary
private final RoundRobinConnectionDistributor.Iterator it

Constructor Detail

RoundRobinConnectionDistributorback to summary
public RoundRobinConnectionDistributor(final NIOTransport transport)
RoundRobinConnectionDistributorback to summary
public RoundRobinConnectionDistributor(final NIOTransport transport, final boolean useDedicatedAcceptor)
RoundRobinConnectionDistributorback to summary
public RoundRobinConnectionDistributor(final NIOTransport transport, final boolean useDedicatedAcceptor, final boolean isServerOnly)

Constructs RoundRobinConnectionDistributor with the given configuration.

Parameters
useDedicatedAcceptor:boolean

depending on this flag server Connections, responsible for accepting client connections, will or will not use dedicated SelectorRunner

isServerOnly:boolean

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

registerChannelback to summary
public void registerChannel(final SelectableChannel channel, final int interestOps, final Object attachment) throws IOException

Implements org.glassfish.grizzly.nio.NIOChannelDistributor.registerChannel.

Annotations
@Override
registerChannelAsyncback to summary
public void registerChannelAsync(final SelectableChannel channel, final int interestOps, final Object attachment, final CompletionHandler<RegisterChannelResult> completionHandler)

Implements org.glassfish.grizzly.nio.NIOChannelDistributor.registerChannelAsync.

Annotations
@Override
registerServiceChannelAsyncback to summary
public void registerServiceChannelAsync(final SelectableChannel channel, final int interestOps, final Object attachment, final CompletionHandler<RegisterChannelResult> completionHandler)

Implements org.glassfish.grizzly.nio.NIOChannelDistributor.registerServiceChannelAsync.

Annotations
@Override
org.glassfish.grizzly.nio back to summary

private final Class RoundRobinConnectionDistributor.DedicatedIterator

extends Object
implements Iterator
Class Inheritance
  • java.lang.Object
  • org.glassfish.grizzly.nio.RoundRobinConnectionDistributor.DedicatedIterator
All Implemented Interfaces
org.glassfish.grizzly.nio.RoundRobinConnectionDistributor.Iterator

Field Summary

Modifier and TypeField and Description
private final AtomicInteger

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public SelectorRunner
public SelectorRunner
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

counterback to summary
private final AtomicInteger counter

Constructor Detail

DedicatedIteratorback to summary
private DedicatedIterator()

Method Detail

nextback to summary
public SelectorRunner next()

Implements org.glassfish.grizzly.nio.RoundRobinConnectionDistributor.Iterator.next.

Annotations
@Override
nextServiceback to summary
public SelectorRunner nextService()

Implements org.glassfish.grizzly.nio.RoundRobinConnectionDistributor.Iterator.nextService.

Annotations
@Override
org.glassfish.grizzly.nio back to summary

private Interface RoundRobinConnectionDistributor.Iterator

Known Direct Implementers
org.glassfish.grizzly.nio.RoundRobinConnectionDistributor.DedicatedIterator, org.glassfish.grizzly.nio.RoundRobinConnectionDistributor.SharedIterator, org.glassfish.grizzly.nio.RoundRobinConnectionDistributor.ServDedicatedIterator, org.glassfish.grizzly.nio.RoundRobinConnectionDistributor.ServSharedIterator

Method Summary

Modifier and TypeMethod and Description
public SelectorRunner
next()

public SelectorRunner

Method Detail

nextback to summary
public SelectorRunner next()
nextServiceback to summary
public SelectorRunner nextService()
org.glassfish.grizzly.nio back to summary

private final Class RoundRobinConnectionDistributor.ServDedicatedIterator

extends Object
implements Iterator
Class Inheritance
  • java.lang.Object
  • org.glassfish.grizzly.nio.RoundRobinConnectionDistributor.ServDedicatedIterator
All Implemented Interfaces
org.glassfish.grizzly.nio.RoundRobinConnectionDistributor.Iterator

Field Summary

Modifier and TypeField and Description
private int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public SelectorRunner
public SelectorRunner
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

counterback to summary
private int counter

Constructor Detail

ServDedicatedIteratorback to summary
private ServDedicatedIterator()

Method Detail

nextback to summary
public SelectorRunner next()

Implements org.glassfish.grizzly.nio.RoundRobinConnectionDistributor.Iterator.next.

Annotations
@Override
nextServiceback to summary
public SelectorRunner nextService()

Implements org.glassfish.grizzly.nio.RoundRobinConnectionDistributor.Iterator.nextService.

Annotations
@Override
org.glassfish.grizzly.nio back to summary

private final Class RoundRobinConnectionDistributor.ServSharedIterator

extends Object
implements Iterator
Class Inheritance
  • java.lang.Object
  • org.glassfish.grizzly.nio.RoundRobinConnectionDistributor.ServSharedIterator
All Implemented Interfaces
org.glassfish.grizzly.nio.RoundRobinConnectionDistributor.Iterator

Field Summary

Modifier and TypeField and Description
private int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public SelectorRunner
public SelectorRunner
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

counterback to summary
private int counter

Constructor Detail

ServSharedIteratorback to summary
private ServSharedIterator()

Method Detail

nextback to summary
public SelectorRunner next()

Implements org.glassfish.grizzly.nio.RoundRobinConnectionDistributor.Iterator.next.

Annotations
@Override
nextServiceback to summary
public SelectorRunner nextService()

Implements org.glassfish.grizzly.nio.RoundRobinConnectionDistributor.Iterator.nextService.

Annotations
@Override
org.glassfish.grizzly.nio back to summary

private final Class RoundRobinConnectionDistributor.SharedIterator

extends Object
implements Iterator
Class Inheritance
  • java.lang.Object
  • org.glassfish.grizzly.nio.RoundRobinConnectionDistributor.SharedIterator
All Implemented Interfaces
org.glassfish.grizzly.nio.RoundRobinConnectionDistributor.Iterator

Field Summary

Modifier and TypeField and Description
private final AtomicInteger

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public SelectorRunner
public SelectorRunner
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

counterback to summary
private final AtomicInteger counter

Constructor Detail

SharedIteratorback to summary
private SharedIterator()

Method Detail

nextback to summary
public SelectorRunner next()

Implements org.glassfish.grizzly.nio.RoundRobinConnectionDistributor.Iterator.next.

Annotations
@Override
nextServiceback to summary
public SelectorRunner nextService()

Implements org.glassfish.grizzly.nio.RoundRobinConnectionDistributor.Iterator.nextService.

Annotations
@Override