public abstract class AbstractController extends Object implements Controller, ControllerLifeCycle
| Modifier and Type | Field and Description |
|---|---|
protected CodecFactory |
codecFactory
Codec Factory
|
protected Configuration |
configuration |
protected Dispatcher |
dispatchMessageDispatcher |
protected int |
dispatchMessageThreadCount |
protected Handler |
handler
Event handler
|
protected boolean |
handleReadWriteConcurrently |
protected InetSocketAddress |
localSocketAddress
local bind address
|
protected static org.slf4j.Logger |
log |
protected Dispatcher |
readEventDispatcher |
protected int |
readThreadCount
Read event processing thread count
|
protected Set<Session> |
sessionSet
Connected session set
|
protected long |
sessionTimeout |
protected Map<SocketOption,Object> |
socketOptions
Socket options
|
protected int |
soTimeout |
protected boolean |
started
Status
|
protected CopyOnWriteArrayList<ControllerStateListener> |
stateListeners
controller state listener list
|
protected Statistics |
statistics |
protected long |
statisticsInterval |
protected Dispatcher |
writeEventDispatcher |
protected int |
writeThreadCount |
| Constructor and Description |
|---|
AbstractController() |
AbstractController(Configuration configuration) |
AbstractController(Configuration configuration,
CodecFactory codecFactory) |
AbstractController(Configuration configuration,
Handler handler,
CodecFactory codecFactory) |
protected Statistics statistics
protected long statisticsInterval
protected static final org.slf4j.Logger log
protected CopyOnWriteArrayList<ControllerStateListener> stateListeners
protected Handler handler
protected volatile CodecFactory codecFactory
protected volatile boolean started
protected InetSocketAddress localSocketAddress
protected int readThreadCount
protected int writeThreadCount
protected int dispatchMessageThreadCount
protected Configuration configuration
protected Dispatcher readEventDispatcher
protected Dispatcher dispatchMessageDispatcher
protected Dispatcher writeEventDispatcher
protected long sessionTimeout
protected volatile boolean handleReadWriteConcurrently
protected int soTimeout
protected Map<SocketOption,Object> socketOptions
public AbstractController()
public AbstractController(Configuration configuration)
public AbstractController(Configuration configuration, CodecFactory codecFactory)
public AbstractController(Configuration configuration, Handler handler, CodecFactory codecFactory)
public void setSocketOptions(Map<SocketOption,Object> socketOptions)
public final int getDispatchMessageThreadCount()
getDispatchMessageThreadCount in interface Controllerpublic final void setDispatchMessageThreadCount(int dispatchMessageThreadPoolSize)
setDispatchMessageThreadCount in interface Controllerpublic long getSessionIdleTimeout()
getSessionIdleTimeout in interface Controllerprotected Queue<WriteMessage> buildQueue()
public void setSessionIdleTimeout(long sessionIdleTimeout)
setSessionIdleTimeout in interface Controllerpublic long getSessionTimeout()
getSessionTimeout in interface Controllerpublic void setSessionTimeout(long sessionTimeout)
setSessionTimeout in interface Controllerpublic int getSoTimeout()
getSoTimeout in interface Controllerpublic void setSoTimeout(int timeout)
setSoTimeout in interface Controllerpublic double getReceiveThroughputLimit()
getReceiveThroughputLimit in interface Controllerpublic double getSendThroughputLimit()
getSendThroughputLimit in interface Controllerpublic void setReceiveThroughputLimit(double receiveThroughputLimit)
setReceiveThroughputLimit in interface Controllerpublic void setSendThroughputLimit(double sendThroughputLimit)
setSendThroughputLimit in interface Controllerpublic Configuration getConfiguration()
public void setConfiguration(Configuration configuration)
public InetSocketAddress getLocalSocketAddress()
getLocalSocketAddress in interface Controllerpublic void setLocalSocketAddress(InetSocketAddress inetSocketAddress)
setLocalSocketAddress in interface Controllerpublic void onAccept(SelectionKey sk) throws IOException
IOExceptionpublic void onConnect(SelectionKey key) throws IOException
IOExceptionpublic void addStateListener(ControllerStateListener listener)
addStateListener in interface Controllerpublic void removeStateListener(ControllerStateListener listener)
removeStateListener in interface Controllerpublic boolean isHandleReadWriteConcurrently()
isHandleReadWriteConcurrently in interface Controllerpublic void setHandleReadWriteConcurrently(boolean handleReadWriteConcurrently)
setHandleReadWriteConcurrently in interface Controllerpublic int getReadThreadCount()
getReadThreadCount in interface Controllerpublic void setReadThreadCount(int readThreadCount)
setReadThreadCount in interface Controllerpublic final int getWriteThreadCount()
getWriteThreadCount in interface Controllerpublic final void setWriteThreadCount(int writeThreadCount)
setWriteThreadCount in interface Controllerpublic Handler getHandler()
getHandler in interface Controllerpublic void setHandler(Handler handler)
setHandler in interface Controllerpublic int getPort()
getPort in interface Controllerpublic void start()
throws IOException
start in interface ControllerIOExceptionprotected abstract void start0()
throws IOException
IOExceptionpublic void notifyStarted()
notifyStarted in interface ControllerLifeCyclepublic boolean isStarted()
isStarted in interface Controllerpublic final Statistics getStatistics()
getStatistics in interface Controllerpublic final CodecFactory getCodecFactory()
getCodecFactory in interface Controllerpublic final void setCodecFactory(CodecFactory codecFactory)
setCodecFactory in interface Controllerpublic void notifyReady()
notifyReady in interface ControllerLifeCyclepublic final void unregisterSession(Session session)
public void checkStatisticsForRestart()
public final void registerSession(Session session)
public void stop()
throws IOException
stop in interface ControllerIOExceptionprotected abstract void stop0()
throws IOException
IOExceptionpublic final void notifyException(Throwable t)
notifyException in interface ControllerLifeCyclepublic final void notifyStopped()
notifyStopped in interface ControllerLifeCyclepublic final void notifyAllSessionClosed()
notifyAllSessionClosed in interface ControllerLifeCyclepublic <T> void setSocketOption(SocketOption<T> socketOption, T value)
setSocketOption in interface Controllerpublic <T> T getSocketOption(SocketOption<T> socketOption)
public void bind(InetSocketAddress inetSocketAddress) throws IOException
inetSocketAddress - IOExceptionCopyright © 2016. All rights reserved.