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>
AbstractNioChannelbase class forChannels 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 protectedAbstractNioMessageChannel(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 booleancloseOnReadError(Throwable cause)protected booleancontinueOnWriteError()Returnstrueif we should continue the write loop on a write error.protected booleancontinueReading(RecvBufferAllocator.Handle allocHandle)protected voiddoBeginRead()Schedule a read operation.protected abstract intdoReadMessages(List<Object> buf)Read messages into the given array and return the amount which was read.protected voiddoWrite(ChannelOutboundBuffer in)Flush the content of the given buffer to the remote peer.protected abstract booleandoWriteMessage(Object msg, ChannelOutboundBuffer in)Write a message to the underlyingChannel.protected voidreadNow()-
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 ExceptionDescription copied from class:AbstractChannelSchedule a read operation.- Overrides:
doBeginReadin 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:
readNowin classAbstractNioChannel<P extends Channel,L extends SocketAddress,R extends SocketAddress>
-
doWrite
protected void doWrite(ChannelOutboundBuffer in) throws Exception
Description copied from class:AbstractChannelFlush the content of the given buffer to the remote peer.- Specified by:
doWritein classAbstractChannel<P extends Channel,L extends SocketAddress,R extends SocketAddress>- Throws:
Exception
-
continueOnWriteError
protected boolean continueOnWriteError()
Returnstrueif 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:
trueif and only if the message has been written- Throws:
Exception
-
-