Module io.netty5.transport
Package io.netty5.channel
Class AbstractServerChannel<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.AbstractServerChannel<P,L,R>
-
- All Implemented Interfaces:
Channel,ChannelOutboundInvoker,IoHandle,ServerChannel,io.netty5.util.AttributeMap,io.netty5.util.concurrent.FuturePromiseFactory,Comparable<Channel>
- Direct Known Subclasses:
LocalServerChannel
public abstract class AbstractServerChannel<P extends Channel,L extends SocketAddress,R extends SocketAddress> extends AbstractChannel<P,L,R> implements ServerChannel
A skeletalServerChannelimplementation.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.netty5.channel.AbstractChannel
AbstractChannel.DefaultAbstractChannelPipeline, AbstractChannel.ReadSink, AbstractChannel.WriteSink
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractServerChannel(EventLoop eventLoop, EventLoopGroup childEventLoopGroup, Class<? extends Channel> childChannelType)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EventLoopGroupchildEventLoopGroup()Returns theEventLoopGroupthat is used to register the childChannels on after accepting these.protected booleandoConnect(SocketAddress remoteAddress, SocketAddress localAddress, io.netty5.buffer.Buffer initialData)Connect to remote peer.protected voiddoDisconnect()Disconnect thisChannelfrom its remote peerprotected booleandoFinishConnect(R requestedRemoteAddress)Finish a connect request.protected voiddoShutdown(ChannelShutdownDirection direction)Shutdown one direction of theChannel.protected voiddoWriteNow(AbstractChannel.WriteSink writeSink)Called in a loop when writes should be performed until this method returnsfalseor there are no more messages to write.protected ObjectfilterOutboundMessage(Object msg)Invoked when a new message is added to to the outbound queue of thisAbstractChannel, so that theChannelimplementation converts the message to another.booleanisShutdown(ChannelShutdownDirection direction)protected RremoteAddress0()Return theSocketAddresswhich theChannelis connected to.-
Methods inherited from class io.netty5.channel.AbstractChannel
bufferAllocator, cacheAddresses, closeFuture, closeTransport, compareTo, doBind, doClearScheduledRead, doClose, doRead, doReadNow, equals, executor, finishConnect, getExtendedOption, getOption, hashCode, id, isConnectPending, isExtendedOptionSupported, isOptionSupported, isReadPending, isRegistered, isSupportingDisconnect, isWriteFlushedScheduled, localAddress, localAddress0, newChannelPipeline, newSupportedIdentityOptionsSet, parent, pipeline, prepareToClose, readBufferAllocator, readHandle, readIfIsAutoRead, readLoopComplete, readNow, remoteAddress, setExtendedOption, setOption, shutdownReadSide, toString, validateEventLoopGroup, validateFileRegion, writableBytes, writeFlushed, writeFlushedNow, writeHandle, writeLoopComplete
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.netty5.channel.Channel
bind, bufferAllocator, close, closeFuture, connect, connect, deregister, disconnect, executor, flush, getOption, id, isActive, isOpen, isOptionSupported, isWritable, localAddress, parent, pipeline, read, read, register, remoteAddress, sendOutboundEvent, setOption, shutdown, writableBytes, write, writeAndFlush
-
Methods inherited from interface io.netty5.channel.ChannelOutboundInvoker
newFailedFuture, newPromise, newSucceededFuture, newSucceededFuture
-
Methods inherited from interface java.lang.Comparable
compareTo
-
Methods inherited from interface io.netty5.channel.IoHandle
isRegistered
-
-
-
-
Constructor Detail
-
AbstractServerChannel
protected AbstractServerChannel(EventLoop eventLoop, EventLoopGroup childEventLoopGroup, Class<? extends Channel> childChannelType)
Creates a new instance.
-
-
Method Detail
-
childEventLoopGroup
public final EventLoopGroup childEventLoopGroup()
Description copied from interface:ServerChannelReturns theEventLoopGroupthat is used to register the childChannels on after accepting these.- Specified by:
childEventLoopGroupin interfaceServerChannel
-
remoteAddress0
protected final R remoteAddress0()
Description copied from class:AbstractChannelReturn theSocketAddresswhich theChannelis connected to.- Specified by:
remoteAddress0in classAbstractChannel<P extends Channel,L extends SocketAddress,R extends SocketAddress>- Returns:
- the remote address if any,
nullotherwise.
-
doDisconnect
protected final void doDisconnect()
Description copied from class:AbstractChannelDisconnect thisChannelfrom its remote peer- Specified by:
doDisconnectin classAbstractChannel<P extends Channel,L extends SocketAddress,R extends SocketAddress>
-
doShutdown
protected final void doShutdown(ChannelShutdownDirection direction)
Description copied from class:AbstractChannelShutdown one direction of theChannel.- Specified by:
doShutdownin classAbstractChannel<P extends Channel,L extends SocketAddress,R extends SocketAddress>- Parameters:
direction- the direction to shut down.
-
isShutdown
public final boolean isShutdown(ChannelShutdownDirection direction)
Description copied from interface:Channel- Specified by:
isShutdownin interfaceChannel
-
doWriteNow
protected final void doWriteNow(AbstractChannel.WriteSink writeSink)
Description copied from class:AbstractChannelCalled in a loop when writes should be performed until this method returnsfalseor there are no more messages to write. Implementations are responsible for handling partial writes, which for example means that ifBuffers are written partial implementations need to ensure thereaderOffsetis updated accordingly.- Specified by:
doWriteNowin classAbstractChannel<P extends Channel,L extends SocketAddress,R extends SocketAddress>- Parameters:
writeSink- theAbstractChannel.WriteSinkthat must be completed with the write progress.AbstractChannel.WriteSink.complete(long, long, int, boolean)orAbstractChannel.WriteSink.complete(long, Throwable, boolean)must be called exactly once before this method returns non-exceptional.
-
filterOutboundMessage
protected final Object filterOutboundMessage(Object msg)
Description copied from class:AbstractChannelInvoked when a new message is added to to the outbound queue of thisAbstractChannel, so that theChannelimplementation converts the message to another. (e.g. heap buffer -> direct buffer)- Overrides:
filterOutboundMessagein classAbstractChannel<P extends Channel,L extends SocketAddress,R extends SocketAddress>- Parameters:
msg- the message to filter / convert.
-
doConnect
protected final boolean doConnect(SocketAddress remoteAddress, SocketAddress localAddress, io.netty5.buffer.Buffer initialData)
Description copied from class:AbstractChannelConnect to remote peer. This method should never be directly called.- Specified by:
doConnectin classAbstractChannel<P extends Channel,L extends SocketAddress,R extends SocketAddress>- Parameters:
remoteAddress- the address of the remote peer.localAddress- the local address of this channel.initialData- the initial data that is written during connect (ifChannelOption.TCP_FASTOPEN_CONNECTis supported and configured). If data is written care must be taken to update thereader offset.- Returns:
trueif the connect operation was completed,falseifAbstractChannel.finishConnect()will be called later again to try finish connecting.
-
doFinishConnect
protected final boolean doFinishConnect(R requestedRemoteAddress)
Description copied from class:AbstractChannelFinish a connect request. This method should never be directly called, useAbstractChannel.finishConnect()instead.- Specified by:
doFinishConnectin classAbstractChannel<P extends Channel,L extends SocketAddress,R extends SocketAddress>- Parameters:
requestedRemoteAddress- the remote address of the peer.- Returns:
trueif the connect operations was completed,falseifAbstractChannel.finishConnect()will be called later again to try finishing the connect operation.
-
-