public abstract class NioController extends AbstractController implements SelectionKeyHandler
Modifier and Type | Field and Description |
---|---|
protected SelectorManager |
selectorManager |
protected int |
selectorPoolSize
Reactor count
|
codecFactory, configuration, dispatchMessageDispatcher, dispatchMessageThreadCount, handler, handleReadWriteConcurrently, localSocketAddress, log, readEventDispatcher, readThreadCount, sessionSet, sessionTimeout, socketOptions, soTimeout, started, stateListeners, statistics, statisticsInterval, writeEventDispatcher, writeThreadCount
Constructor and Description |
---|
NioController() |
NioController(Configuration configuration) |
NioController(Configuration configuration,
CodecFactory codecFactory) |
NioController(Configuration configuration,
Handler handler,
CodecFactory codecFactory) |
Modifier and Type | Method and Description |
---|---|
void |
bind(int port) |
protected NioSessionConfig |
buildSessionConfig(SelectableChannel sc,
Queue<WriteMessage> queue)
Build nio session config
|
void |
closeSelectionKey(SelectionKey key)
Cancel selection key
|
protected abstract void |
dispatchReadEvent(SelectionKey key)
Dispatch read event
|
protected abstract void |
dispatchWriteEvent(SelectionKey key)
Dispatch write event
|
protected abstract void |
doStart()
Inner startup
|
SelectorManager |
getSelectorManager() |
int |
getSelectorPoolSize() |
protected void |
initialSelectorManager()
Start selector manager
|
void |
onRead(SelectionKey key)
Read event occured
|
void |
onWrite(SelectionKey key)
Writable event occured
|
void |
setSelectorPoolSize(int selectorPoolSize) |
protected void |
start0() |
protected void |
stop0() |
addStateListener, bind, buildQueue, checkStatisticsForRestart, getCodecFactory, getConfiguration, getDispatchMessageThreadCount, getHandler, getLocalSocketAddress, getPort, getReadThreadCount, getReceiveThroughputLimit, getSendThroughputLimit, getSessionIdleTimeout, getSessionSet, getSessionTimeout, getSocketOption, getSoTimeout, getStatistics, getWriteThreadCount, isHandleReadWriteConcurrently, isStarted, notifyAllSessionClosed, notifyException, notifyReady, notifyStarted, notifyStopped, onAccept, onConnect, registerSession, removeStateListener, setCodecFactory, setConfiguration, setDispatchMessageThreadCount, setHandler, setHandleReadWriteConcurrently, setLocalSocketAddress, setReadThreadCount, setReceiveThroughputLimit, setSendThroughputLimit, setSessionIdleTimeout, setSessionTimeout, setSocketOption, setSocketOptions, setSoTimeout, setWriteThreadCount, start, stop, unregisterSession
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
closeChannel, onAccept, onConnect
protected SelectorManager selectorManager
protected int selectorPoolSize
public NioController()
public NioController(Configuration configuration, CodecFactory codecFactory)
public NioController(Configuration configuration, Handler handler, CodecFactory codecFactory)
public NioController(Configuration configuration)
public int getSelectorPoolSize()
setSelectorPoolSize
public void setSelectorPoolSize(int selectorPoolSize)
public final SelectorManager getSelectorManager()
protected void start0() throws IOException
start0
in class AbstractController
IOException
protected void initialSelectorManager() throws IOException
IOException
protected abstract void doStart() throws IOException
IOException
public void onRead(SelectionKey key)
onRead
in interface SelectionKeyHandler
public void onWrite(SelectionKey key)
onWrite
in interface SelectionKeyHandler
public void closeSelectionKey(SelectionKey key)
closeSelectionKey
in interface SelectionKeyHandler
protected abstract void dispatchReadEvent(SelectionKey key)
key
- protected abstract void dispatchWriteEvent(SelectionKey key)
key
- protected void stop0() throws IOException
stop0
in class AbstractController
IOException
public void bind(int port) throws IOException
IOException
protected final NioSessionConfig buildSessionConfig(SelectableChannel sc, Queue<WriteMessage> queue)
sc
- queue
- Copyright © 2021. All rights reserved.