Module io.netty5.transport
Package io.netty5.channel.nio
Class AbstractNioChannel<P extends Channel,L extends SocketAddress,R extends SocketAddress>
- java.lang.Object
-
- io.netty5.util.DefaultAttributeMap
-
- io.netty5.channel.AbstractChannel<P,L,R>
-
- io.netty5.channel.nio.AbstractNioChannel<P,L,R>
-
- All Implemented Interfaces:
Channel,ChannelOutboundInvoker,IoHandle,AttributeMap,FuturePromiseFactory,Comparable<Channel>
- Direct Known Subclasses:
AbstractNioByteChannel,AbstractNioMessageChannel
public abstract class AbstractNioChannel<P extends Channel,L extends SocketAddress,R extends SocketAddress> extends AbstractChannel<P,L,R>
Abstract base class forChannelimplementations which use a Selector based approach.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.netty5.channel.AbstractChannel
AbstractChannel.DefaultAbstractChannelPipeline
-
-
Field Summary
Fields Modifier and Type Field Description protected intreadInterestOp
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractNioChannel(P parent, EventLoop eventLoop, ChannelMetadata metadata, RecvBufferAllocator defaultRecvAllocator, SelectableChannel ch, int readInterestOp)Create a new instance
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidclearReadPending()Set read pending tofalse.protected voiddoBeginRead()Schedule a read operation.protected voiddoClose()Close theChannelbooleanisOpen()Returnstrueif theChannelis open and may get active laterprotected booleanisReadPending()Deprecated.No longer supported.protected SelectableChanneljavaChannel()protected BuffernewDirectBuffer(Buffer buf)Allocates a new off-heap copy of the given buffer, unless the cost of doing so is too high.protected BuffernewDirectBuffer(Resource<?> holder, Buffer buf)Allocates a new off-heap copy of the given buffer, unless the cost of doing so is too high.protected abstract voidreadNow()protected voidremoveReadOp()protected SelectionKeyselectionKey()Return the currentSelectionKeyornullif the underlying channel was not registered with theSelectoryet.protected voidsetReadPending(boolean readPending)Deprecated.UseclearReadPending()if appropriate instead.protected voidwriteFlushed()Write previous flushed messages.-
Methods inherited from class io.netty5.channel.AbstractChannel
annotateConnectException, assertEventLoop, autoReadCleared, bufferAllocator, cacheAddresses, closeForciblyTransport, closeFuture, closeIfClosed, closeTransport, compareTo, deregisterTransport, doBind, doConnect, doDisconnect, doFinishConnect, doShutdown, doWrite, ensureOpen, equals, executor, filterOutboundMessage, finishConnect, fireChannelActiveIfNotActiveBefore, getExtendedOption, getMaxMessagesPerWrite, getOption, getWriteSpinCount, handleWriteError, hashCode, id, isAllowHalfClosure, isAutoRead, isConnectPending, isExtendedOptionSupported, isOptionSupported, isRegistered, localAddress, localAddress0, metadata, newChannelPipeline, newSupportedIdentityOptionsSet, outboundBuffer, parent, pipeline, prepareToClose, readIfIsAutoRead, recvBufAllocHandle, remoteAddress, remoteAddress0, runAfterTransportAction, safeSetFailure, safeSetSuccess, setBufferAllocator, setExtendedOption, setOption, shutdownTransport, toString, validate, validateEventLoopGroup, validateFileRegion, writableBytes
-
Methods inherited from class io.netty5.util.DefaultAttributeMap
attr, hasAttr
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.netty5.util.AttributeMap
attr, hasAttr
-
Methods inherited from interface io.netty5.channel.Channel
bind, close, connect, connect, deregister, disconnect, flush, isActive, isShutdown, isWritable, read, register, sendOutboundEvent, shutdown, write, writeAndFlush
-
Methods inherited from interface io.netty5.channel.ChannelOutboundInvoker
newFailedFuture, newPromise, newSucceededFuture, newSucceededFuture
-
-
-
-
Constructor Detail
-
AbstractNioChannel
protected AbstractNioChannel(P parent, EventLoop eventLoop, ChannelMetadata metadata, RecvBufferAllocator defaultRecvAllocator, SelectableChannel ch, int readInterestOp)
Create a new instance- Parameters:
parent- the parentChannelby which this instance was created. May benulleventLoop- theEventLoopto use for all I/O.metadata- theChannelMetadatato use.defaultRecvAllocator- the defaultRecvBufferAllocatorto use.ch- the underlyingSelectableChannelon which it operatesreadInterestOp- the ops to set to receive data from theSelectableChannel
-
-
Method Detail
-
isOpen
public boolean isOpen()
Description copied from interface:ChannelReturnstrueif theChannelis open and may get active later
-
javaChannel
protected SelectableChannel javaChannel()
-
selectionKey
protected SelectionKey selectionKey()
Return the currentSelectionKeyornullif the underlying channel was not registered with theSelectoryet.
-
isReadPending
@Deprecated protected boolean isReadPending()
Deprecated.No longer supported. No longer supported.
-
setReadPending
@Deprecated protected void setReadPending(boolean readPending)
Deprecated.UseclearReadPending()if appropriate instead. No longer supported.
-
clearReadPending
protected final void clearReadPending()
Set read pending tofalse.
-
removeReadOp
protected final void removeReadOp()
-
writeFlushed
protected final void writeFlushed()
Description copied from class:AbstractChannelWrite previous flushed messages.- Overrides:
writeFlushedin classAbstractChannel<P extends Channel,L extends SocketAddress,R extends SocketAddress>
-
doBeginRead
protected void doBeginRead() throws ExceptionDescription copied from class:AbstractChannelSchedule a read operation.- Specified by:
doBeginReadin classAbstractChannel<P extends Channel,L extends SocketAddress,R extends SocketAddress>- Throws:
Exception
-
doClose
protected void doClose() throws ExceptionDescription copied from class:AbstractChannelClose theChannel- Specified by:
doClosein classAbstractChannel<P extends Channel,L extends SocketAddress,R extends SocketAddress>- Throws:
Exception
-
newDirectBuffer
protected final Buffer newDirectBuffer(Buffer buf)
Allocates a new off-heap copy of the given buffer, unless the cost of doing so is too high. The given buffer is closed if a copy is created, or returned directly.- Parameters:
buf- The buffer to copy.- Returns:
- Probably an off-heap copy of the given buffer.
-
newDirectBuffer
protected final Buffer newDirectBuffer(Resource<?> holder, Buffer buf)
Allocates a new off-heap copy of the given buffer, unless the cost of doing so is too high. The given holder is closed regardless.- Parameters:
buf- The buffer to copy.- Returns:
- Probably an off-heap copy of the given buffer.
-
readNow
protected abstract void readNow()
-
-