com.sun.grizzly
Class RoundRobinSelectorHandler
java.lang.Object
com.sun.grizzly.TCPSelectorHandler
com.sun.grizzly.RoundRobinSelectorHandler
- All Implemented Interfaces:
- ComplexSelectorHandler, Handler, LinuxSpinningWorkaround, SelectorHandler, PendingIOhandler, AttributeHolder, Copyable, SupportStateHolder<State>
public class RoundRobinSelectorHandler
- extends TCPSelectorHandler
- implements ComplexSelectorHandler
A SelectorHandler handles all java.nio.channels.Selector operations.
One or more instance of a Selector are handled by SelectorHandler.
The logic for processing of SelectionKey interest (OP_ACCEPT,OP_READ, etc.)
is usually defined using an instance of SelectorHandler.
This class represents a TCP implementation of a SelectorHandler,
which handles "accept" events by registering newly accepted connections
to auxiliary Controllers in a round robin fashion.
- Author:
- Alexey Stashok
| Fields inherited from class com.sun.grizzly.TCPSelectorHandler |
asyncQueueReader, asyncQueueWriter, attributes, connectorInstanceHandler, inet, instanceHandler, isKeepAlive, isShutDown, linger, logger, portRange, postponedTasks, receiveBufferSize, reuseAddress, role, selectionKeyHandler, selector, selectorHandlerTasks, selectTimeout, sendBufferSize, serverSocket, serverSocketChannel, serverTimeout, socketTimeout, ssBackLog, stateHolder, tcpNoDelay, threadPool |
| Methods inherited from class com.sun.grizzly.TCPSelectorHandler |
acceptWithoutRegistration, acquireConnectorHandler, addPendingIO, addPendingKeyCancel, boolean2Role, closeChannel, configureChannel, connect, getAsyncQueueReader, getAsyncQueueWriter, getAttribute, getAttributes, getConnectorInstanceHandlerDelegate, getInet, getLinger, getLogger, getPort, getPortLowLevel, getPortRange, getPreferredSelectionKeyHandler, getProtocolChainInstanceHandler, getRole, getSelectableChannel, getSelectionKeyHandler, getSelector, getSelectTimeout, getServerTimeout, getSocketTimeout, getSpinRate, getSsBackLog, getStateHolder, getThreadPool, invokeAsyncQueueReader, invokeAsyncQueueWriter, invokeCallbackHandler, isExecutePendingIOUsingSelectorThread, isKeepAlive, isOpen, isReuseAddress, isTcpNoDelay, keyFor, keys, onConnectInterest, onConnectOp, onReadInterest, onWriteInterest, pause, pollContext, postSelect, preSelect, processPendingOperations, protocol, register, register, register, releaseConnectorHandler, removeAttribute, resetSpinCounter, resume, select, setAttribute, setAttributes, setExecutePendingIOUsingSelectorThread, setInet, setKeepAlive, setLinger, setLogger, setMaxAcceptRetries, setPort, setPortRange, setProtocolChainInstanceHandler, setReceiveBufferSize, setReuseAddress, setRole, setSelectionKeyHandler, setSelector, setSelectTimeout, setSendBufferSize, setServerTimeout, setSocketTimeout, setSsBackLog, setTcpNoDelay, setThreadPool, workaroundSelectorSpin |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.sun.grizzly.SelectorHandler |
acceptWithoutRegistration, acquireConnectorHandler, closeChannel, configureChannel, getAsyncQueueReader, getAsyncQueueWriter, getPreferredSelectionKeyHandler, getProtocolChainInstanceHandler, getSelectionKeyHandler, getSelector, getThreadPool, isOpen, keyFor, keys, onConnectInterest, onReadInterest, onWriteInterest, pause, postSelect, preSelect, protocol, register, register, register, releaseConnectorHandler, resume, select, setProtocolChainInstanceHandler, setSelectionKeyHandler, setSelector, setThreadPool |
RoundRobinSelectorHandler
public RoundRobinSelectorHandler()
RoundRobinSelectorHandler
public RoundRobinSelectorHandler(ReadController[] rrControllers)
copyTo
public void copyTo(Copyable copy)
- Specified by:
copyTo in interface Copyable- Overrides:
copyTo in class TCPSelectorHandler
onAcceptInterest
public boolean onAcceptInterest(java.nio.channels.SelectionKey key,
Context context)
throws java.io.IOException
- Description copied from class:
TCPSelectorHandler
- Handle OP_ACCEPT.
- Specified by:
onAcceptInterest in interface SelectorHandler- Overrides:
onAcceptInterest in class TCPSelectorHandler
- Parameters:
key - SelectionKeycontext - Context
- Returns:
- always returns false
- Throws:
java.io.IOException
addProtocolSupport
public void addProtocolSupport(Controller.Protocol customProtocol)
- Add custom protocol support
- Parameters:
customProtocol - custom Controller.Protocol
supportsProtocol
public boolean supportsProtocol(Controller.Protocol protocol)
- Checks if protocol is supported by RoundRobinSelectorHandler
- Specified by:
supportsProtocol in interface ComplexSelectorHandler
- Parameters:
protocol - Network protocol name
- Returns:
- true if protocol is supported, false otherwise
supportsClient
public boolean supportsClient(SelectorHandler selectorHandler)
- Checks if given
SelectorHandler is supported on client-side by RoundRobinSelectorHandler
- Specified by:
supportsClient in interface ComplexSelectorHandler
- Parameters:
selectorHandler - SelectorHandler
- Returns:
- true if
selectorHandler is supported, false otherwise
nextController
public ReadController nextController()
- Return next aux. ReadController to process an accepted connection
- Specified by:
nextController in interface ComplexSelectorHandler
- Returns:
- next aux.
ReadController
shutdown
public void shutdown()
- Description copied from class:
TCPSelectorHandler
- Shutdown this instance by closing its Selector and associated channels.
- Specified by:
shutdown in interface SelectorHandler- Overrides:
shutdown in class TCPSelectorHandler
Copyright © 2012 Oracle Corporation. All Rights Reserved.