public class NioTCPSession extends AbstractNioSession
Session.SessionStatusselectableChannel, selectorManagerattributes, 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, writeFromUserCodeclearAttributes, 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, writeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclearAttributes, 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, writepublic NioTCPSession(NioSessionConfig sessionConfig, int readRecvBufferSize)
public final boolean isExpired()
SessionisExpired in interface SessionisExpired in class AbstractSessionprotected Object writeToChannel(WriteMessage message) throws IOException
writeToChannel in class AbstractNioSessionIOExceptionpublic InetSocketAddress getRemoteSocketAddress()
Sessionprotected final Object blockingWrite(SelectableChannel channel, WriteMessage message, IoBuffer writeBuffer) throws IOException, ClosedChannelException
channel - message - writeBuffer - IOExceptionClosedChannelExceptionprotected WriteMessage wrapMessage(Object msg, Future<Boolean> writeFuture)
wrapMessage in class AbstractSessionprotected void readFromBuffer()
readFromBuffer in class AbstractNioSessionprotected final int blockingRead()
throws ClosedChannelException,
IOException
ClosedChannelExceptionIOExceptionpublic void decode()
decode in class AbstractSessionpublic Socket socket()
protected final void closeChannel()
throws IOException
closeChannel in class AbstractNioSessionIOExceptionCopyright © 2016. All rights reserved.