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-sideChannel
implementation. A server-sideChannel
does 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 protected
AbstractServerChannel(EventLoop eventLoop, EventLoopGroup childEventLoopGroup, ChannelMetadata metadata, Class<? extends Channel> childChannelType)
protected
AbstractServerChannel(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 EventLoopGroup
childEventLoopGroup()
Returns theEventLoopGroup
that is used to register the childChannel
s on.protected boolean
doConnect(SocketAddress remoteAddress, SocketAddress localAddress)
Connect to remote peer.protected void
doDisconnect()
Disconnect thisChannel
from its remote peerprotected boolean
doFinishConnect(R requestedRemoteAddress)
Finish a connect request.protected void
doShutdown(ChannelShutdownDirection direction)
Shutdown one direction of theChannel
.protected void
doWrite(ChannelOutboundBuffer in)
Flush the content of the given buffer to the remote peer.protected Object
filterOutboundMessage(Object msg)
Invoked when a new message is added to aChannelOutboundBuffer
of thisAbstractChannel
, so that theChannel
implementation converts the message to another.boolean
isShutdown(ChannelShutdownDirection direction)
protected R
remoteAddress0()
Return theSocketAddress
which theChannel
is 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:ServerChannel
Returns theEventLoopGroup
that is used to register the childChannel
s on.- Specified by:
childEventLoopGroup
in interfaceServerChannel
-
remoteAddress0
protected final R remoteAddress0()
Description copied from class:AbstractChannel
Return theSocketAddress
which theChannel
is connected to.- Specified by:
remoteAddress0
in classAbstractChannel<P extends Channel,L extends SocketAddress,R extends SocketAddress>
-
doDisconnect
protected final void doDisconnect()
Description copied from class:AbstractChannel
Disconnect thisChannel
from its remote peer- Specified by:
doDisconnect
in classAbstractChannel<P extends Channel,L extends SocketAddress,R extends SocketAddress>
-
doShutdown
protected final void doShutdown(ChannelShutdownDirection direction)
Description copied from class:AbstractChannel
Shutdown one direction of theChannel
.- Specified by:
doShutdown
in 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:
isShutdown
in interfaceChannel
-
doWrite
protected final void doWrite(ChannelOutboundBuffer in)
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>
-
filterOutboundMessage
protected final Object filterOutboundMessage(Object msg)
Description copied from class:AbstractChannel
Invoked when a new message is added to aChannelOutboundBuffer
of thisAbstractChannel
, so that theChannel
implementation converts the message to another. (e.g. heap buffer -> direct buffer)- Overrides:
filterOutboundMessage
in classAbstractChannel<P extends Channel,L extends SocketAddress,R extends SocketAddress>
-
doConnect
protected boolean doConnect(SocketAddress remoteAddress, SocketAddress localAddress)
Description copied from class:AbstractChannel
Connect to remote peer.- Specified by:
doConnect
in 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:
true
if the connect was completed,false
ifAbstractChannel.finishConnect()
will be called later again to try finishing the connect.
-
doFinishConnect
protected boolean doFinishConnect(R requestedRemoteAddress)
Description copied from class:AbstractChannel
Finish a connect request.- Specified by:
doFinishConnect
in classAbstractChannel<P extends Channel,L extends SocketAddress,R extends SocketAddress>
- Parameters:
requestedRemoteAddress
- the remote address of the peer.- Returns:
true
if the connect was completed,false
ifAbstractChannel.finishConnect()
will be called later again to try finishing the connect.
-
-