public abstract class AbstractNioSession extends AbstractIoSession
IoSession
implmentation.IoSession.SessionState
Modifier and Type | Field and Description |
---|---|
protected SelectableChannel |
channel
the NIO channel for this session
|
config, idleChecker, secured, state
SSL_HELPER
Constructor and Description |
---|
AbstractNioSession(IoService service,
SelectableChannel channel,
IdleChecker idleChecker) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
channelClose()
Close the inner socket channel
|
IoFuture<Void> |
close(boolean immediately)
Closes this session immediately or after all queued write requests are flushed.
|
protected abstract ByteBuffer |
convertToDirectBuffer(WriteRequest writeRequest,
boolean createNew)
Copy the HeapBuffer into a DirectBuffer, if needed.
|
WriteRequest |
enqueueWriteRequest(WriteRequest writeRequest)
Internal method for enqueue write request after filter chain processing
|
abstract void |
flushWriteQueue() |
Queue<WriteRequest> |
getWriteQueue()
Get the
Queue of this session. |
protected boolean |
isRegisteredForWrite() |
void |
processWrite(SelectorLoop selectorLoop)
Process a write operation.
|
void |
setNotRegisteredForWrite() |
protected abstract int |
writeDirect(Object message)
Writes the message immediately.
|
callReadNextFilter, callWriteNextFilter, changeState, getAttribute, getAttribute, getAttributeKeys, getCreationTime, getId, getLastIoTime, getLastReadTime, getLastWriteTime, getReadBytes, getService, getWrittenBytes, incrementWrittenBytes, initSecure, isClosed, isClosing, isConnected, isConnectedSecured, isCreated, isSecured, isSecuring, processException, processMessageReceived, processMessageSent, processMessageWriting, processSessionClosed, processSessionIdle, processSessionOpen, removeAttribute, setAttribute, setSecured, toString, write, writeWithFuture
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getConfig, getLocalAddress, getRemoteAddress, isReadSuspended, isWriteSuspended, resumeRead, resumeWrite, suspendRead, suspendWrite
protected final SelectableChannel channel
public AbstractNioSession(IoService service, SelectableChannel channel, IdleChecker idleChecker)
protected abstract int writeDirect(Object message)
message
- the message to writeprotected abstract ByteBuffer convertToDirectBuffer(WriteRequest writeRequest, boolean createNew)
writeRequest
- The request containing the HeapBuffercreateNew
- A flag to force the creation of a DirectBufferpublic IoFuture<Void> close(boolean immediately)
IoFuture
if you want to wait for the session actually closed. Once this method has
been called, no incoming request will be accepted.immediately
- true
to close this session immediately. false
to close this session after all
queued write requests are flushed.IoFuture
that will contains the session's stateprotected abstract void channelClose()
public WriteRequest enqueueWriteRequest(WriteRequest writeRequest)
writeRequest
- the message to put in the write requestpublic abstract void flushWriteQueue()
public void setNotRegisteredForWrite()
protected boolean isRegisteredForWrite()
public Queue<WriteRequest> getWriteQueue()
Queue
of this session. The write queue contains the pending writes.public void processWrite(SelectorLoop selectorLoop)
Copyright © 2009–2013 Apache MINA Project. All rights reserved.