public class NioTCPSession extends AbstractNioSession
Session.SessionStatus
selectableChannel, selectorManager
attributes, closed, currentMessage, decoder, dispatchMessageDispatcher, encoder, handler, handleReadWriteConcurrently, lastOperationTimeStamp, log, loopback, readBuffer, scheduleWritenBytes, sessionIdleTimeout, sessionTimeout, statistics, useBlockingRead, useBlockingWrite, writeLock, writeQueue
Constructor and Description |
---|
NioTCPSession(NioSessionConfig sessionConfig,
int readRecvBufferSize) |
Modifier and Type | Method and Description |
---|---|
protected int |
blockingRead()
Blocking read using temp selector
|
protected Object |
blockingWrite(SelectableChannel channel,
WriteMessage message,
IoBuffer writeBuffer)
Blocking write using temp selector
|
protected void |
closeChannel() |
void |
decode()
Decode buffer
|
InetSocketAddress |
getRemoteSocketAddress()
Return the remote end's InetSocketAddress
|
boolean |
isExpired()
Return true if session is expired,session is expired beacause you set the sessionTimeout,if
since session's last operation form now is over this vlaue,isExpired return true,and
Handler.onExpired() will be invoked.
|
protected void |
readFromBuffer() |
Socket |
socket() |
protected WriteMessage |
wrapMessage(Object msg,
Future<Boolean> writeFuture) |
protected Object |
writeToChannel(WriteMessage message) |
channel, doRealWrite, enableRead, enableWrite, flush, flush0, getLocalAddress, onEvent, onRead, onWrite, registerSession, schduleWriteMessage, start0, unregisterChannel, unregisterSession, writeFromUserCode
clearAttributes, clearWriteQueue, close, dispatchReceivedMessage, getAttribute, getDecoder, getDispatchMessageDispatcher, getEncoder, getHandler, getLastOperationTimeStamp, getReadBuffer, getReadBufferByteOrder, getScheduleWritenBytes, getSessionIdleTimeout, getSessionTimeout, getStatistics, getWriteLock, getWriteQueue, isClosed, 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, write
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clearAttributes, close, getAttribute, getDecoder, getEncoder, getHandler, getLastOperationTimeStamp, getReadBufferByteOrder, getScheduleWritenBytes, getSessionIdleTimeout, getSessionTimeout, isClosed, isHandleReadWriteConcurrently, isIdle, isLoopbackConnection, isUseBlockingRead, isUseBlockingWrite, removeAttribute, setAttribute, setAttributeIfAbsent, setDecoder, setEncoder, setHandleReadWriteConcurrently, setReadBufferByteOrder, setSessionIdleTimeout, setSessionTimeout, setUseBlockingRead, setUseBlockingWrite, start, write
public NioTCPSession(NioSessionConfig sessionConfig, int readRecvBufferSize)
public final boolean isExpired()
Session
isExpired
in interface Session
isExpired
in class AbstractSession
protected Object writeToChannel(WriteMessage message) throws IOException
writeToChannel
in class AbstractNioSession
IOException
public InetSocketAddress getRemoteSocketAddress()
Session
protected final Object blockingWrite(SelectableChannel channel, WriteMessage message, IoBuffer writeBuffer) throws IOException, ClosedChannelException
channel
- message
- writeBuffer
- IOException
ClosedChannelException
protected WriteMessage wrapMessage(Object msg, Future<Boolean> writeFuture)
wrapMessage
in class AbstractSession
protected void readFromBuffer()
readFromBuffer
in class AbstractNioSession
protected final int blockingRead() throws ClosedChannelException, IOException
ClosedChannelException
IOException
public void decode()
decode
in class AbstractSession
public Socket socket()
protected final void closeChannel() throws IOException
closeChannel
in class AbstractNioSession
IOException
Copyright © 2021. All rights reserved.