Module io.netty5.transport
Package io.netty5.channel.nio
Class AbstractNioMessageChannel<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>
-
- io.netty5.channel.nio.AbstractNioMessageChannel<P,L,R>
-
- All Implemented Interfaces:
Channel
,ChannelOutboundInvoker
,IoHandle
,AttributeMap
,FuturePromiseFactory
,Comparable<Channel>
- Direct Known Subclasses:
NioDatagramChannel
,NioServerSocketChannel
public abstract class AbstractNioMessageChannel<P extends Channel,L extends SocketAddress,R extends SocketAddress> extends AbstractNioChannel<P,L,R>
AbstractNioChannel
base class forChannel
s that operate on messages.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.netty5.channel.AbstractChannel
AbstractChannel.DefaultAbstractChannelPipeline
-
-
Field Summary
-
Fields inherited from class io.netty5.channel.nio.AbstractNioChannel
readInterestOp
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractNioMessageChannel(P parent, EventLoop eventLoop, ChannelMetadata metadata, RecvBufferAllocator defaultRecvAllocator, SelectableChannel ch, int readInterestOp)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected boolean
closeOnReadError(Throwable cause)
protected boolean
continueOnWriteError()
Returnstrue
if we should continue the write loop on a write error.protected boolean
continueReading(RecvBufferAllocator.Handle allocHandle)
protected void
doBeginRead()
Schedule a read operation.protected abstract int
doReadMessages(List<Object> buf)
Read messages into the given array and return the amount which was read.protected void
doWrite(ChannelOutboundBuffer in)
Flush the content of the given buffer to the remote peer.protected abstract boolean
doWriteMessage(Object msg, ChannelOutboundBuffer in)
Write a message to the underlyingChannel
.protected void
readNow()
-
Methods inherited from class io.netty5.channel.nio.AbstractNioChannel
clearReadPending, doClose, isOpen, isReadPending, javaChannel, newDirectBuffer, newDirectBuffer, removeReadOp, selectionKey, setReadPending, writeFlushed
-
Methods inherited from class io.netty5.channel.AbstractChannel
annotateConnectException, assertEventLoop, autoReadCleared, bufferAllocator, cacheAddresses, closeForciblyTransport, closeFuture, closeIfClosed, closeTransport, compareTo, deregisterTransport, doBind, doConnect, doDisconnect, doFinishConnect, doShutdown, 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
-
AbstractNioMessageChannel
protected AbstractNioMessageChannel(P parent, EventLoop eventLoop, ChannelMetadata metadata, RecvBufferAllocator defaultRecvAllocator, SelectableChannel ch, int readInterestOp)
-
-
Method Detail
-
doBeginRead
protected void doBeginRead() throws Exception
Description copied from class:AbstractChannel
Schedule a read operation.- Overrides:
doBeginRead
in classAbstractNioChannel<P extends Channel,L extends SocketAddress,R extends SocketAddress>
- Throws:
Exception
-
continueReading
protected boolean continueReading(RecvBufferAllocator.Handle allocHandle)
-
readNow
protected final void readNow()
- Specified by:
readNow
in classAbstractNioChannel<P extends Channel,L extends SocketAddress,R extends SocketAddress>
-
doWrite
protected void doWrite(ChannelOutboundBuffer in) throws Exception
Description copied from class:AbstractChannel
Flush the content of the given buffer to the remote peer.- Specified by:
doWrite
in classAbstractChannel<P extends Channel,L extends SocketAddress,R extends SocketAddress>
- Throws:
Exception
-
continueOnWriteError
protected boolean continueOnWriteError()
Returnstrue
if we should continue the write loop on a write error.
-
closeOnReadError
protected boolean closeOnReadError(Throwable cause)
-
doReadMessages
protected abstract int doReadMessages(List<Object> buf) throws Exception
Read messages into the given array and return the amount which was read.- Throws:
Exception
-
doWriteMessage
protected abstract boolean doWriteMessage(Object msg, ChannelOutboundBuffer in) throws Exception
Write a message to the underlyingChannel
.- Returns:
true
if and only if the message has been written- Throws:
Exception
-
-