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, write
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clearAttributes, 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, write
protected SelectorManager selectorManager
protected SelectableChannel selectableChannel
public AbstractNioSession(NioSessionConfig sessionConfig)
public SelectableChannel channel()
NioSession
channel
in interface NioSession
public final void enableRead(Selector selector)
NioSession
enableRead
in interface NioSession
protected void start0()
start0
in class AbstractSession
public InetAddress getLocalAddress()
getLocalAddress
in interface Session
protected abstract Object writeToChannel(WriteMessage msg) throws ClosedChannelException, IOException
ClosedChannelException
IOException
protected void onWrite(SelectionKey key)
public final void enableWrite(Selector selector)
NioSession
enableWrite
in interface NioSession
protected void onRead(SelectionKey key)
protected abstract void readFromBuffer()
protected void closeChannel() throws IOException
closeChannel
in class AbstractSession
IOException
protected final void unregisterChannel() throws IOException
IOException
protected final void registerSession()
protected void unregisterSession()
public void writeFromUserCode(WriteMessage message)
writeFromUserCode
in class AbstractSession
protected boolean schduleWriteMessage(WriteMessage writeMessage)
public void flush()
Session
protected final void flush0()
protected final long doRealWrite(SelectableChannel channel, IoBuffer buffer) throws IOException
IOException
public final void onEvent(EventType event, Selector selector)
onEvent
in interface NioSession
Copyright © 2021. All rights reserved.