Class AbstractNioChannel
java.lang.Object
io.netty.util.DefaultAttributeMap
io.netty.channel.AbstractChannel
io.netty.channel.nio.AbstractNioChannel
- All Implemented Interfaces:
Channel, ChannelOutboundInvoker, AttributeMap, Comparable<Channel>
- Direct Known Subclasses:
AbstractNioByteChannel, AbstractNioMessageChannel
Abstract base class for
Channel implementations which use a Selector based approach.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classstatic interfaceSpecialChannel.Unsafesub-type which allows to access the underlyingSelectableChannelNested classes/interfaces inherited from class AbstractChannel
AbstractChannel.AbstractUnsafeNested classes/interfaces inherited from interface Channel
Channel.Unsafe -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractNioChannel(Channel parent, SelectableChannel ch, int readInterestOp) Create a new instance -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidSet read pending tofalse.protected voidSchedule a read operation.protected voiddoClose()Close theChannelprotected abstract booleandoConnect(SocketAddress remoteAddress, SocketAddress localAddress) Connect to the remote peerprotected voidprotected abstract voidFinish the connectprotected voidprotected booleanisCompatible(EventLoop loop) Returntrueif the givenEventLoopis compatible with this instance.booleanisOpen()Returnstrueif theChannelis open and may get active laterprotected booleanDeprecated.No longer supported.protected SelectableChannelprotected final ByteBufnewDirectBuffer(ByteBuf buf) Returns an off-heap copy of the specifiedByteBuf, and releases the original one.protected final ByteBufnewDirectBuffer(ReferenceCounted holder, ByteBuf buf) Returns an off-heap copy of the specifiedByteBuf, and releases the specified holder.protected SelectionKeyReturn the currentSelectionKeyprotected voidsetReadPending(boolean readPending) Deprecated.UseclearReadPending()if appropriate instead.unsafe()Returns an internal-use-only object that provides unsafe operations.Methods inherited from class AbstractChannel
alloc, bind, bind, bytesBeforeUnwritable, bytesBeforeWritable, close, close, closeFuture, compareTo, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, doBind, doDisconnect, doShutdownOutput, doWrite, equals, filterOutboundMessage, flush, hashCode, id, invalidateLocalAddress, invalidateRemoteAddress, isRegistered, isWritable, localAddress, localAddress0, maxMessagesPerWrite, newChannelPipeline, newFailedFuture, newId, newProgressivePromise, newPromise, newSucceededFuture, newUnsafe, parent, pipeline, read, remoteAddress, remoteAddress0, toString, validateFileRegion, voidPromise, write, write, writeAndFlush, writeAndFlushMethods inherited from class DefaultAttributeMap
attr, hasAttrMethods inherited from interface AttributeMap
attr, hasAttr
-
Field Details
-
readInterestOp
protected final int readInterestOp
-
-
Constructor Details
-
AbstractNioChannel
Create a new instance- Parameters:
parent- the parentChannelby which this instance was created. May benullch- the underlyingSelectableChannelon which it operatesreadInterestOp- the ops to set to receive data from theSelectableChannel
-
-
Method Details
-
isOpen
-
unsafe
Description copied from interface:ChannelReturns an internal-use-only object that provides unsafe operations.- Specified by:
unsafein interfaceChannel- Overrides:
unsafein classAbstractChannel
-
javaChannel
-
eventLoop
Description copied from interface:Channel- Specified by:
eventLoopin interfaceChannel- Overrides:
eventLoopin classAbstractChannel
-
selectionKey
Return the currentSelectionKey -
isReadPending
Deprecated.No longer supported. No longer supported. -
setReadPending
Deprecated.UseclearReadPending()if appropriate instead. No longer supported. -
clearReadPending
protected final void clearReadPending()Set read pending tofalse. -
isCompatible
Description copied from class:AbstractChannelReturntrueif the givenEventLoopis compatible with this instance.- Specified by:
isCompatiblein classAbstractChannel
-
doRegister
Description copied from class:AbstractChannelIs called after theChannelis registered with itsEventLoopas part of the register process. Sub-classes may override this method- Overrides:
doRegisterin classAbstractChannel- Throws:
Exception
-
doDeregister
Description copied from class:AbstractChannel- Overrides:
doDeregisterin classAbstractChannel- Throws:
Exception
-
doBeginRead
Description copied from class:AbstractChannelSchedule a read operation.- Specified by:
doBeginReadin classAbstractChannel- Throws:
Exception
-
doConnect
protected abstract boolean doConnect(SocketAddress remoteAddress, SocketAddress localAddress) throws Exception Connect to the remote peer- Throws:
Exception
-
doFinishConnect
-
newDirectBuffer
-
newDirectBuffer
Returns an off-heap copy of the specifiedByteBuf, and releases the specified holder. The caller must ensure that the holder releases the originalByteBufwhen the holder is released by this method. Note that this method does not create an off-heap copy if the allocation / deallocation cost is too high, but just returns the originalByteBuf.. -
doClose
Description copied from class:AbstractChannelClose theChannel- Specified by:
doClosein classAbstractChannel- Throws:
Exception
-