Package com.google.code.yanf4j.nio.impl
Class AbstractNioSession
java.lang.Object
com.google.code.yanf4j.core.impl.AbstractSession
com.google.code.yanf4j.nio.impl.AbstractNioSession
- All Implemented Interfaces:
Session,NioSession
- Direct Known Subclasses:
NioTCPSession
Abstract nio session
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.google.code.yanf4j.core.Session
Session.SessionStatus -
Field Summary
FieldsFields inherited from class com.google.code.yanf4j.core.impl.AbstractSession
attributes, closed, currentMessage, decoder, dispatchMessageDispatcher, encoder, handler, handleReadWriteConcurrently, lastOperationTimeStamp, log, loopback, readBuffer, scheduleWritenBytes, sessionIdleTimeout, sessionTimeout, statistics, useBlockingRead, useBlockingWrite, writeLock, writeQueue -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionchannel()return the channel for this connectionprotected voidprotected final longdoRealWrite(SelectableChannel channel, IoBuffer buffer) final voidenableRead(Selector selector) Enable read eventfinal voidenableWrite(Selector selector) Enable write eventvoidflush()Flush the write queue,this method may be no effect if OP_WRITE is running.protected final voidflush0()private voidinterestRead(SelectionKey key) private voidfinal void�ɷ�IO�¼�protected voidonRead(SelectionKey key) protected voidonWrite(SelectionKey key) protected abstract voidprotected final voidprotected booleanschduleWriteMessage(WriteMessage writeMessage) protected voidstart0()protected final voidprotected voidvoidwriteFromUserCode(WriteMessage message) protected abstract ObjectMethods inherited from class com.google.code.yanf4j.core.impl.AbstractSession
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, writeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.google.code.yanf4j.core.Session
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
-
Field Details
-
selectorManager
-
selectableChannel
-
-
Constructor Details
-
AbstractNioSession
-
-
Method Details
-
channel
Description copied from interface:NioSessionreturn the channel for this connection- Specified by:
channelin interfaceNioSession- Returns:
-
enableRead
Description copied from interface:NioSessionEnable read event- Specified by:
enableReadin interfaceNioSession- Parameters:
selector-
-
interestRead
-
start0
protected void start0()- Specified by:
start0in classAbstractSession
-
getLocalAddress
- Specified by:
getLocalAddressin interfaceSession
-
writeToChannel
protected abstract Object writeToChannel(WriteMessage msg) throws ClosedChannelException, IOException - Throws:
ClosedChannelExceptionIOException
-
onWrite
-
enableWrite
Description copied from interface:NioSessionEnable write event- Specified by:
enableWritein interfaceNioSession- Parameters:
selector-
-
interestWrite
-
onRead
-
readFromBuffer
protected abstract void readFromBuffer() -
closeChannel
- Specified by:
closeChannelin classAbstractSession- Throws:
IOException
-
unregisterChannel
- Throws:
IOException
-
registerSession
protected final void registerSession() -
unregisterSession
protected void unregisterSession() -
writeFromUserCode
- Specified by:
writeFromUserCodein classAbstractSession
-
schduleWriteMessage
-
flush
public void flush()Description copied from interface:SessionFlush the write queue,this method may be no effect if OP_WRITE is running. -
flush0
protected final void flush0() -
doRealWrite
- Throws:
IOException
-
onEvent
�ɷ�IO�¼�- Specified by:
onEventin interfaceNioSession- Parameters:
event-selector-
-