public abstract class AbstractController extends Object implements Controller, ControllerLifeCycle
| 限定符和类型 | 字段和说明 |
|---|---|
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 |
| 构造器和说明 |
|---|
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 在接口中 Controllerpublic final void setDispatchMessageThreadCount(int dispatchMessageThreadPoolSize)
setDispatchMessageThreadCount 在接口中 Controllerpublic long getSessionIdleTimeout()
getSessionIdleTimeout 在接口中 Controllerprotected Queue<WriteMessage> buildQueue()
public void setSessionIdleTimeout(long sessionIdleTimeout)
setSessionIdleTimeout 在接口中 Controllerpublic long getSessionTimeout()
getSessionTimeout 在接口中 Controllerpublic void setSessionTimeout(long sessionTimeout)
setSessionTimeout 在接口中 Controllerpublic int getSoTimeout()
getSoTimeout 在接口中 Controllerpublic void setSoTimeout(int timeout)
setSoTimeout 在接口中 Controllerpublic double getReceiveThroughputLimit()
getReceiveThroughputLimit 在接口中 Controllerpublic double getSendThroughputLimit()
getSendThroughputLimit 在接口中 Controllerpublic void setReceiveThroughputLimit(double receiveThroughputLimit)
setReceiveThroughputLimit 在接口中 Controllerpublic void setSendThroughputLimit(double sendThroughputLimit)
setSendThroughputLimit 在接口中 Controllerpublic Configuration getConfiguration()
public void setConfiguration(Configuration configuration)
public InetSocketAddress getLocalSocketAddress()
getLocalSocketAddress 在接口中 Controllerpublic void setLocalSocketAddress(InetSocketAddress inetSocketAddress)
setLocalSocketAddress 在接口中 Controllerpublic void onAccept(SelectionKey sk) throws IOException
IOExceptionpublic void onConnect(SelectionKey key) throws IOException
IOExceptionpublic void addStateListener(ControllerStateListener listener)
addStateListener 在接口中 Controllerpublic void removeStateListener(ControllerStateListener listener)
removeStateListener 在接口中 Controllerpublic boolean isHandleReadWriteConcurrently()
isHandleReadWriteConcurrently 在接口中 Controllerpublic void setHandleReadWriteConcurrently(boolean handleReadWriteConcurrently)
setHandleReadWriteConcurrently 在接口中 Controllerpublic int getReadThreadCount()
getReadThreadCount 在接口中 Controllerpublic void setReadThreadCount(int readThreadCount)
setReadThreadCount 在接口中 Controllerpublic final int getWriteThreadCount()
getWriteThreadCount 在接口中 Controllerpublic final void setWriteThreadCount(int writeThreadCount)
setWriteThreadCount 在接口中 Controllerpublic Handler getHandler()
getHandler 在接口中 Controllerpublic void setHandler(Handler handler)
setHandler 在接口中 Controllerpublic int getPort()
getPort 在接口中 Controllerpublic void start()
throws IOException
start 在接口中 ControllerIOExceptionprotected abstract void start0()
throws IOException
IOExceptionpublic void notifyStarted()
notifyStarted 在接口中 ControllerLifeCyclepublic boolean isStarted()
isStarted 在接口中 Controllerpublic final Statistics getStatistics()
getStatistics 在接口中 Controllerpublic final CodecFactory getCodecFactory()
getCodecFactory 在接口中 Controllerpublic final void setCodecFactory(CodecFactory codecFactory)
setCodecFactory 在接口中 Controllerpublic void notifyReady()
notifyReady 在接口中 ControllerLifeCyclepublic final void unregisterSession(Session session)
public void checkStatisticsForRestart()
public final void registerSession(Session session)
public void stop()
throws IOException
stop 在接口中 ControllerIOExceptionprotected abstract void stop0()
throws IOException
IOExceptionpublic final void notifyException(Throwable t)
notifyException 在接口中 ControllerLifeCyclepublic final void notifyStopped()
notifyStopped 在接口中 ControllerLifeCyclepublic final void notifyAllSessionClosed()
notifyAllSessionClosed 在接口中 ControllerLifeCyclepublic <T> void setSocketOption(SocketOption<T> socketOption, T value)
setSocketOption 在接口中 Controllerpublic <T> T getSocketOption(SocketOption<T> socketOption)
public void bind(InetSocketAddress inetSocketAddress) throws IOException
inetSocketAddress - IOExceptionCopyright © 2013. All Rights Reserved.