|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.code.yanf4j.core.impl.AbstractController
public abstract class AbstractController
Base controller
| Field Summary | |
|---|---|
protected CodecFactory |
codecFactory
Codec Factory |
protected Configuration |
configuration
|
protected Dispatcher |
dispatchMessageDispatcher
|
protected int |
dispatchMessageThreadCount
|
protected Handler |
handler
Event handler |
protected boolean |
handleReadWriteConcurrently
|
protected java.net.InetSocketAddress |
localSocketAddress
local bind address |
protected static org.slf4j.Logger |
log
|
protected Dispatcher |
readEventDispatcher
|
protected int |
readThreadCount
Read event processing thread count |
protected java.util.Set<Session> |
sessionSet
Connected session set |
protected long |
sessionTimeout
|
protected java.util.Map<SocketOption,java.lang.Object> |
socketOptions
Socket options |
protected int |
soTimeout
|
protected boolean |
started
Status |
protected java.util.concurrent.CopyOnWriteArrayList<ControllerStateListener> |
stateListeners
controller state listener list |
protected Statistics |
statistics
|
protected long |
statisticsInterval
|
protected Dispatcher |
writeEventDispatcher
|
protected int |
writeThreadCount
|
| Constructor Summary | |
|---|---|
AbstractController()
|
|
AbstractController(Configuration configuration)
|
|
AbstractController(Configuration configuration,
CodecFactory codecFactory)
|
|
AbstractController(Configuration configuration,
Handler handler,
CodecFactory codecFactory)
|
|
| Method Summary | ||
|---|---|---|
void |
addStateListener(ControllerStateListener listener)
|
|
void |
bind(java.net.InetSocketAddress inetSocketAddress)
Bind localhost address |
|
protected java.util.Queue<WriteMessage> |
buildQueue()
Build write queue for session |
|
void |
checkStatisticsForRestart()
|
|
CodecFactory |
getCodecFactory()
|
|
Configuration |
getConfiguration()
|
|
int |
getDispatchMessageThreadCount()
|
|
Handler |
getHandler()
|
|
java.net.InetSocketAddress |
getLocalSocketAddress()
|
|
int |
getPort()
|
|
int |
getReadThreadCount()
|
|
double |
getReceiveThroughputLimit()
|
|
double |
getSendThroughputLimit()
|
|
long |
getSessionIdleTimeout()
|
|
java.util.Set<Session> |
getSessionSet()
|
|
long |
getSessionTimeout()
|
|
|
getSocketOption(SocketOption<T> socketOption)
|
|
int |
getSoTimeout()
|
|
Statistics |
getStatistics()
|
|
int |
getWriteThreadCount()
|
|
boolean |
isHandleReadWriteConcurrently()
|
|
boolean |
isStarted()
|
|
void |
notifyAllSessionClosed()
|
|
void |
notifyException(java.lang.Throwable t)
|
|
void |
notifyReady()
|
|
void |
notifyStarted()
|
|
void |
notifyStopped()
|
|
void |
onAccept(java.nio.channels.SelectionKey sk)
|
|
void |
onConnect(java.nio.channels.SelectionKey key)
|
|
void |
registerSession(Session session)
|
|
void |
removeStateListener(ControllerStateListener listener)
|
|
void |
setCodecFactory(CodecFactory codecFactory)
|
|
void |
setConfiguration(Configuration configuration)
|
|
void |
setDispatchMessageThreadCount(int dispatchMessageThreadPoolSize)
|
|
void |
setHandler(Handler handler)
|
|
void |
setHandleReadWriteConcurrently(boolean handleReadWriteConcurrently)
|
|
void |
setLocalSocketAddress(java.net.InetSocketAddress inetSocketAddress)
|
|
void |
setReadThreadCount(int readThreadCount)
|
|
void |
setReceiveThroughputLimit(double receiveThroughputLimit)
|
|
void |
setSendThroughputLimit(double sendThroughputLimit)
|
|
void |
setSessionIdleTimeout(long sessionIdleTimeout)
|
|
void |
setSessionTimeout(long sessionTimeout)
|
|
|
setSocketOption(SocketOption<T> socketOption,
T value)
|
|
void |
setSocketOptions(java.util.Map<SocketOption,java.lang.Object> socketOptions)
|
|
void |
setSoTimeout(int timeout)
|
|
void |
setWriteThreadCount(int writeThreadCount)
|
|
void |
start()
|
|
protected abstract void |
start0()
|
|
void |
stop()
|
|
protected abstract void |
stop0()
|
|
void |
unregisterSession(Session session)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Statistics statistics
protected long statisticsInterval
protected static final org.slf4j.Logger log
protected java.util.concurrent.CopyOnWriteArrayList<ControllerStateListener> stateListeners
protected Handler handler
protected volatile CodecFactory codecFactory
protected volatile boolean started
protected java.net.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 java.util.Map<SocketOption,java.lang.Object> socketOptions
protected java.util.Set<Session> sessionSet
| Constructor Detail |
|---|
public AbstractController()
public AbstractController(Configuration configuration)
public AbstractController(Configuration configuration,
CodecFactory codecFactory)
public AbstractController(Configuration configuration,
Handler handler,
CodecFactory codecFactory)
| Method Detail |
|---|
public void setSocketOptions(java.util.Map<SocketOption,java.lang.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 java.util.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 java.net.InetSocketAddress getLocalSocketAddress()
getLocalSocketAddress in interface Controllerpublic void setLocalSocketAddress(java.net.InetSocketAddress inetSocketAddress)
setLocalSocketAddress in interface Controller
public void onAccept(java.nio.channels.SelectionKey sk)
throws java.io.IOException
java.io.IOException
public void onConnect(java.nio.channels.SelectionKey key)
throws java.io.IOException
java.io.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 Controller
public void start()
throws java.io.IOException
start in interface Controllerjava.io.IOException
protected abstract void start0()
throws java.io.IOException
java.io.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 java.io.IOException
stop in interface Controllerjava.io.IOException
protected abstract void stop0()
throws java.io.IOException
java.io.IOExceptionpublic final void notifyException(java.lang.Throwable t)
notifyException in interface ControllerLifeCyclepublic final void notifyStopped()
notifyStopped in interface ControllerLifeCyclepublic final void notifyAllSessionClosed()
notifyAllSessionClosed in interface ControllerLifeCyclepublic java.util.Set<Session> getSessionSet()
public <T> void setSocketOption(SocketOption<T> socketOption,
T value)
setSocketOption in interface Controllerpublic <T> T getSocketOption(SocketOption<T> socketOption)
public void bind(java.net.InetSocketAddress inetSocketAddress)
throws java.io.IOException
inetSocketAddress -
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||