public abstract class AbstractNioSession extends AbstractSession implements NioSession
Session.SessionStatus| Modifier and Type | Field and Description |
|---|---|
protected SelectableChannel |
selectableChannel |
protected SelectorManager |
selectorManager |
attributes, closed, currentMessage, decoder, dispatchMessageDispatcher, encoder, handler, handleReadWriteConcurrently, lastOperationTimeStamp, log, loopback, readBuffer, scheduleWritenBytes, sessionIdleTimeout, sessionTimeout, statistics, useBlockingRead, useBlockingWrite, writeLock, writeQueue| Constructor and Description |
|---|
AbstractNioSession(NioSessionConfig sessionConfig) |
| Modifier and Type | Method and Description |
|---|---|
SelectableChannel |
channel()
return the channel for this connection
|
protected void |
closeChannel() |
protected long |
doRealWrite(SelectableChannel channel,
IoBuffer buffer) |
void |
enableRead(Selector selector)
Enable read event
|
void |
enableWrite(Selector selector)
Enable write event
|
void |
flush()
Flush the write queue,this method may be no effect if OP_WRITE is
running.
|
protected void |
flush0() |
InetAddress |
getLocalAddress() |
void |
onEvent(EventType event,
Selector selector)
�ɷ�IO�¼�
|
protected void |
onRead(SelectionKey key) |
protected void |
onWrite(SelectionKey key) |
protected abstract void |
readFromBuffer() |
protected void |
registerSession() |
protected boolean |
schduleWriteMessage(WriteMessage writeMessage) |
protected void |
start0() |
protected void |
unregisterChannel() |
protected void |
unregisterSession() |
void |
writeFromUserCode(WriteMessage message) |
protected abstract Object |
writeToChannel(WriteMessage msg) |
clearAttributes, clearWriteQueue, close, decode, dispatchReceivedMessage, getAttribute, getDecoder, getDispatchMessageDispatcher, getEncoder, getHandler, getLastOperationTimeStamp, getReadBuffer, getReadBufferByteOrder, getScheduleWritenBytes, getSessionIdleTimeout, getSessionTimeout, getStatistics, getWriteLock, getWriteQueue, isClosed, isExpired, isHandleReadWriteConcurrently, isIdle, isLoopbackConnection, isUseBlockingRead, isUseBlockingWrite, onClosed, onConnected, onCreated, onException, onExpired, onIdle, onStarted, preprocessWriteMessage, removeAttribute, setAttribute, setAttributeIfAbsent, setClosed, setDecoder, setEncoder, setHandleReadWriteConcurrently, setReadBuffer, setReadBufferByteOrder, setSessionIdleTimeout, setSessionTimeout, setUseBlockingRead, setUseBlockingWrite, start, transferFrom, transferTo, updateTimeStamp, wrapMessage, writeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclearAttributes, close, getAttribute, getDecoder, getEncoder, getHandler, getLastOperationTimeStamp, getReadBufferByteOrder, getRemoteSocketAddress, getScheduleWritenBytes, getSessionIdleTimeout, getSessionTimeout, isClosed, isExpired, isHandleReadWriteConcurrently, isIdle, isLoopbackConnection, isUseBlockingRead, isUseBlockingWrite, removeAttribute, setAttribute, setAttributeIfAbsent, setDecoder, setEncoder, setHandleReadWriteConcurrently, setReadBufferByteOrder, setSessionIdleTimeout, setSessionTimeout, setUseBlockingRead, setUseBlockingWrite, start, writeprotected SelectorManager selectorManager
protected SelectableChannel selectableChannel
public AbstractNioSession(NioSessionConfig sessionConfig)
public SelectableChannel channel()
NioSessionchannel in interface NioSessionpublic final void enableRead(Selector selector)
NioSessionenableRead in interface NioSessionprotected void start0()
start0 in class AbstractSessionpublic InetAddress getLocalAddress()
getLocalAddress in interface Sessionprotected abstract Object writeToChannel(WriteMessage msg) throws ClosedChannelException, IOException
ClosedChannelExceptionIOExceptionprotected void onWrite(SelectionKey key)
public final void enableWrite(Selector selector)
NioSessionenableWrite in interface NioSessionprotected void onRead(SelectionKey key)
protected abstract void readFromBuffer()
protected void closeChannel()
throws IOException
closeChannel in class AbstractSessionIOExceptionprotected final void unregisterChannel()
throws IOException
IOExceptionprotected final void registerSession()
protected void unregisterSession()
public void writeFromUserCode(WriteMessage message)
writeFromUserCode in class AbstractSessionprotected boolean schduleWriteMessage(WriteMessage writeMessage)
public void flush()
Sessionprotected final void flush0()
protected final long doRealWrite(SelectableChannel channel, IoBuffer buffer) throws IOException
IOExceptionpublic final void onEvent(EventType event, Selector selector)
onEvent in interface NioSessionCopyright © 2016. All rights reserved.