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,AttributeMap,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 skeletal server-sideChannelimplementation. A server-sideChanneldoes not allow the following operations:Channel.connect(SocketAddress)Channel.disconnect()Channel.write(Object)Channel.flush()Channel.shutdown(ChannelShutdownDirection)- and the shortcut methods which calls the methods mentioned above
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.netty5.channel.AbstractChannel
AbstractChannel.DefaultAbstractChannelPipeline
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractServerChannel(EventLoop eventLoop, EventLoopGroup childEventLoopGroup, ChannelMetadata metadata, Class<? extends Channel> childChannelType)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.protected booleandoConnect(SocketAddress remoteAddress, SocketAddress localAddress)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 voiddoWrite(ChannelOutboundBuffer in)Flush the content of the given buffer to the remote peer.protected ObjectfilterOutboundMessage(Object msg)Invoked when a new message is added to aChannelOutboundBufferof 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
annotateConnectException, assertEventLoop, autoReadCleared, bufferAllocator, cacheAddresses, closeForciblyTransport, closeFuture, closeIfClosed, closeTransport, compareTo, deregisterTransport, doBeginRead, doBind, doClose, ensureOpen, equals, executor, 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, runAfterTransportAction, safeSetFailure, safeSetSuccess, setBufferAllocator, setExtendedOption, setOption, shutdownTransport, toString, validate, validateEventLoopGroup, validateFileRegion, writableBytes, writeFlushed
-
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, bufferAllocator, close, closeFuture, connect, connect, deregister, disconnect, executor, flush, getOption, id, isActive, isOpen, isOptionSupported, isWritable, localAddress, metadata, parent, pipeline, 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.
-
AbstractServerChannel
protected AbstractServerChannel(EventLoop eventLoop, EventLoopGroup childEventLoopGroup, ChannelMetadata metadata, Class<? extends Channel> childChannelType)
-
-
Method Detail
-
childEventLoopGroup
public final EventLoopGroup childEventLoopGroup()
Description copied from interface:ServerChannelReturns theEventLoopGroupthat is used to register the childChannels on.- 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>
-
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 shutdown.
-
isShutdown
public final boolean isShutdown(ChannelShutdownDirection direction)
Description copied from interface:Channel- Specified by:
isShutdownin interfaceChannel
-
doWrite
protected final void doWrite(ChannelOutboundBuffer in)
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>
-
filterOutboundMessage
protected final Object filterOutboundMessage(Object msg)
Description copied from class:AbstractChannelInvoked when a new message is added to aChannelOutboundBufferof 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>
-
doConnect
protected boolean doConnect(SocketAddress remoteAddress, SocketAddress localAddress)
Description copied from class:AbstractChannelConnect to remote peer.- 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.- Returns:
trueif the connect was completed,falseifAbstractChannel.finishConnect()will be called later again to try finishing the connect.
-
doFinishConnect
protected boolean doFinishConnect(R requestedRemoteAddress)
Description copied from class:AbstractChannelFinish a connect request.- 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 was completed,falseifAbstractChannel.finishConnect()will be called later again to try finishing the connect.
-
-