Package com.google.code.yanf4j.nio
Class TCPController
java.lang.Object
com.google.code.yanf4j.core.impl.AbstractController
com.google.code.yanf4j.nio.impl.NioController
com.google.code.yanf4j.nio.impl.SocketChannelController
com.google.code.yanf4j.nio.TCPController
- All Implemented Interfaces:
Controller,ControllerLifeCycle,SelectionKeyHandler
Controller for tcp server
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intAccept backlog queue sizeprivate intprivate intprivate intprivate ServerSocketChannelFields inherited from class com.google.code.yanf4j.nio.impl.SocketChannelController
soLingerOnFields inherited from class com.google.code.yanf4j.nio.impl.NioController
selectorManager, selectorPoolSizeFields inherited from class com.google.code.yanf4j.core.impl.AbstractController
codecFactory, configuration, dispatchMessageDispatcher, dispatchMessageThreadCount, handler, handleReadWriteConcurrently, localSocketAddress, log, readEventDispatcher, readThreadCount, sessionSet, sessionTimeout, socketOptions, soTimeout, started, stateListeners, statistics, statisticsInterval, writeEventDispatcher, writeThreadCount -
Constructor Summary
ConstructorsConstructorDescriptionTCPController(Configuration configuration) TCPController(Configuration configuration, CodecFactory codecFactory) TCPController(Configuration configuration, Handler handler, CodecFactory codecFactory) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidvoidcloseChannel(Selector selector) protected voiddoStart()Inner startupintvoidonAccept(SelectionKey selectionKey) voidsetBacklog(int backlog) voidsetPerformancePreferences(int connectionTime, int latency, int bandwidth) voidunbind()Methods inherited from class com.google.code.yanf4j.nio.impl.SocketChannelController
buildSession, configureSocketChannel, dispatchReadEvent, dispatchWriteEvent, setSoLingerMethods inherited from class com.google.code.yanf4j.nio.impl.NioController
bind, buildSessionConfig, closeSelectionKey, getSelectorManager, getSelectorPoolSize, initialSelectorManager, onRead, onWrite, setSelectorPoolSize, start0, stop0Methods inherited from class com.google.code.yanf4j.core.impl.AbstractController
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, onConnect, registerSession, removeStateListener, setCodecFactory, setConfiguration, setDispatchMessageThreadCount, setHandler, setHandleReadWriteConcurrently, setLocalSocketAddress, setReadThreadCount, setReceiveThroughputLimit, setSendThroughputLimit, setSessionIdleTimeout, setSessionTimeout, setSocketOption, setSocketOptions, setSoTimeout, setWriteThreadCount, start, stop, unregisterSessionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.google.code.yanf4j.nio.SelectionKeyHandler
onConnect
-
Field Details
-
serverSocketChannel
-
backlog
private int backlogAccept backlog queue size -
connectionTime
private int connectionTime -
latency
private int latency -
bandwidth
private int bandwidth
-
-
Constructor Details
-
TCPController
public TCPController() -
TCPController
-
TCPController
-
TCPController
-
-
Method Details
-
getBacklog
public int getBacklog() -
setBacklog
public void setBacklog(int backlog) -
setPerformancePreferences
public void setPerformancePreferences(int connectionTime, int latency, int bandwidth) -
doStart
Description copied from class:NioControllerInner startup- Specified by:
doStartin classNioController- Throws:
IOException
-
onAccept
- Specified by:
onAcceptin interfaceSelectionKeyHandler- Overrides:
onAcceptin classAbstractController- Throws:
IOException
-
closeAcceptChannel
private void closeAcceptChannel(SelectionKey sk, SocketChannel sc) throws IOException, SocketException - Parameters:
sk-sc-- Throws:
IOExceptionSocketException
-
closeChannel
- Throws:
IOException
-
unbind
- Throws:
IOException
-