Top Description Fields Constructors Methods
io.netty5.channel.kqueue

public final Class KQueueServerSocketChannel

extends AbstractKQueueChannel<UnixChannel>
implements ServerSocketChannel
Class Inheritance
All Implemented Interfaces
io.netty5.channel.socket.ServerSocketChannel, io.netty5.channel.ServerChannel, io.netty5.channel.Channel, io.netty5.channel.IoHandle, java.lang.Comparable, io.netty5.channel.ChannelOutboundInvoker, io.netty5.util.concurrent.FuturePromiseFactory, io.netty5.util.AttributeMap
Annotations
@UnstableApi
Imports
io.netty5.buffer.Buffer, io.netty5.channel.Channel, .ChannelException, .ChannelOption, .ChannelShutdownDirection, .EventLoop, .EventLoopGroup, .ServerChannelReadHandleFactory, .ServerChannelWriteHandleFactory, io.netty5.channel.socket.DomainSocketAddress, .ServerSocketChannel, .SocketProtocolFamily, io.netty5.channel.unix.IntegerUnixChannelOption, .RawUnixChannelOption, .UnixChannel, io.netty5.util.NetUtil, io.netty5.util.internal.UnstableApi, io.netty5.util.internal.logging.InternalLogger, .InternalLoggerFactory, java.io.File, .IOException, java.net.ProtocolFamily, .SocketAddress, java.util.Set

ServerSocketChannel implementation that uses KQueue.

Available options

In addition to the options provided by ServerSocketChannel and UnixChannel, KQueueServerSocketChannel allows the following options in the option map:
ChannelOption INET INET6 UNIX
IntegerUnixChannelOptionXXX
RawUnixChannelOptionXXX
ChannelOption#TCP_FASTOPENXX-
KQueueChannelOption#SO_ACCEPTFILTERXXX
io.netty5.channel.unix.UnixChannelOption#SO_REUSEPORTXX-

Field Summary

Modifier and TypeField and Description
private final byte[]
private volatile int
private final EventLoopGroup
private volatile boolean
private static final InternalLogger
private static final Set<ChannelOption<?>>
private static final Set<ChannelOption<?>>
Inherited from io.netty5.channel.kqueue.AbstractKQueueChannel:
activesocket

Constructor Summary

AccessConstructor and Description
public
KQueueServerSocketChannel(EventLoop eventLoop, EventLoopGroup childEventLoopGroup)

public
KQueueServerSocketChannel(EventLoop eventLoop, EventLoopGroup childEventLoopGroup, ProtocolFamily protocolFamily)

public
KQueueServerSocketChannel(EventLoop eventLoop, EventLoopGroup childEventLoopGroup, int fd, ProtocolFamily protocolFamily)

private
KQueueServerSocketChannel(EventLoop eventLoop, EventLoopGroup childEventLoopGroup, BsdSocket socket)

Method Summary

Modifier and TypeMethod and Description
public EventLoopGroup
childEventLoopGroup()

Implements io.netty5.channel.ServerChannel.childEventLoopGroup.

Returns the EventLoopGroup that is used to register the child Channels on after accepting these.
protected void
protected void
protected boolean
doConnect(SocketAddress
the address of the remote peer.
remoteAddress
,
SocketAddress
the local address of this channel.
localAddress
,
Buffer
the initial data that is written during connect (if ChannelOption#TCP_FASTOPEN_CONNECT is supported and configured). If data is written care must be taken to update the reader offset.
initialData
)

Overrides io.netty5.channel.kqueue.AbstractKQueueChannel.doConnect.

Connect to the remote peer
protected void
doShutdown(ChannelShutdownDirection
the direction to shut down.
direction
)

Implements abstract io.netty5.channel.AbstractChannel.doShutdown.

Shutdown one direction of the Channel.
protected void
doWriteNow(AbstractChannel<UnixChannel, SocketAddress, SocketAddress>.WriteSink
the WriteSink that must be completed with the write progress. WriteSink#complete(long, long, int, boolean) or WriteSink#complete(long, Throwable, boolean) must be called exactly once before this method returns non-exceptional.
writeHandle
)

Implements abstract io.netty5.channel.AbstractChannel.doWriteNow.

Called in a loop when writes should be performed until this method returns false or there are no more messages to write.
protected Object
filterOutboundMessage(Object
the message to filter / convert.
msg
)

Overrides io.netty5.channel.AbstractChannel.filterOutboundMessage.

Invoked when a new message is added to to the outbound queue of this AbstractChannel, so that the Channel implementation converts the message to another.
private AcceptFilter
private int
protected <T> T
private int
protected boolean
private boolean
private boolean
public boolean
isShutdown(ChannelShutdownDirection direction)

Implements io.netty5.channel.Channel.isShutdown.

Returns true if the ChannelShutdownDirection of the Channel was shutdown before.
private boolean
isSupported(SocketProtocolFamily protocolFamily, ChannelOption<?> option)

private boolean
isTcpFastOpen()

Returns true if TCP FastOpen is enabled.

private Channel
newChildChannel(int fd, byte[] address, int offset, int len)

pack-priv int
protected SocketAddress
private void
private void
setBacklog(int backlog)

protected <T> void
private void
setReceiveBufferSize(int receiveBufferSize)

private void
setReuseAddress(boolean reuseAddress)

private void
setReusePort(boolean reusePort)

private void
setTcpFastOpen(boolean
true if TCP FastOpen should be enabled for incomming connections.
enableTcpFastOpen
)

Enables TCP FastOpen on the server channel.

private static Set<ChannelOption<?>>
private static Set<ChannelOption<?>>
Inherited from io.netty5.channel.kqueue.AbstractKQueueChannel:
checkResolvablecloseTransportNowderegister0doClearScheduledReaddoConnect0doDisconnectdoFinishConnectdoReaddoReadBytesdoReadNowdoWriteBytesfdfetchLocalAddressisActiveisOpenisSoErrorZeroisWriteFlushedScheduledlocalAddress0newDirectBuffernewDirectBufferreadBufferAllocatorreadEOFreadFilterreadLoopCompletereadReadyregister0registrationresetCachedAddressesunregisterFilterswriteFilterwriteLoopCompletewriteReady

Field Detail

acceptedAddressback to summary
private final byte[] acceptedAddress
backlogback to summary
private volatile int backlog
childEventLoopGroupback to summary
private final EventLoopGroup childEventLoopGroup
enableTcpFastOpenback to summary
private volatile boolean enableTcpFastOpen
loggerback to summary
private static final InternalLogger logger

Hides io.netty5.channel.AbstractChannel.logger.

SUPPORTED_OPTIONSback to summary
private static final Set<ChannelOption<?>> SUPPORTED_OPTIONS
SUPPORTED_OPTIONS_DOMAINback to summary
private static final Set<ChannelOption<?>> SUPPORTED_OPTIONS_DOMAIN

Constructor Detail

KQueueServerSocketChannelback to summary
public KQueueServerSocketChannel(EventLoop eventLoop, EventLoopGroup childEventLoopGroup)
KQueueServerSocketChannelback to summary
public KQueueServerSocketChannel(EventLoop eventLoop, EventLoopGroup childEventLoopGroup, ProtocolFamily protocolFamily)
KQueueServerSocketChannelback to summary
public KQueueServerSocketChannel(EventLoop eventLoop, EventLoopGroup childEventLoopGroup, int fd, ProtocolFamily protocolFamily)
KQueueServerSocketChannelback to summary
private KQueueServerSocketChannel(EventLoop eventLoop, EventLoopGroup childEventLoopGroup, BsdSocket socket)

Method Detail

childEventLoopGroupback to summary
public EventLoopGroup childEventLoopGroup()

Implements io.netty5.channel.ServerChannel.childEventLoopGroup.

Doc from io.netty5.channel.ServerChannel.childEventLoopGroup.

Returns the EventLoopGroup that is used to register the child Channels on after accepting these.

Annotations
@Override
doBindback to summary
protected void doBind(SocketAddress localAddress) throws Exception

Overrides io.netty5.channel.kqueue.AbstractKQueueChannel.doBind.

Doc from io.netty5.channel.AbstractChannel.doBind.

Bind the Channel to the SocketAddress

Parameters
localAddress:SocketAddress

the SocketAddress to bound to.

Annotations
@Override
Exceptions
Exception:
when an error happens.
doCloseback to summary
protected void doClose() throws Exception

Overrides io.netty5.channel.kqueue.AbstractKQueueChannel.doClose.

Doc from io.netty5.channel.AbstractChannel.doClose.

Close the Channel

Annotations
@Override
Exceptions
Exception:
thrown on error.
doConnectback to summary
protected boolean doConnect(SocketAddress remoteAddress, SocketAddress localAddress, Buffer initialData)

Overrides io.netty5.channel.kqueue.AbstractKQueueChannel.doConnect.

Doc from io.netty5.channel.kqueue.AbstractKQueueChannel.doConnect.

Connect to the remote peer

Parameters
remoteAddress:SocketAddress

Doc from io.netty5.channel.AbstractChannel.doConnect.

the address of the remote peer.

localAddress:SocketAddress

Doc from io.netty5.channel.AbstractChannel.doConnect.

the local address of this channel.

initialData:Buffer

Doc from io.netty5.channel.AbstractChannel.doConnect.

the initial data that is written during connect (if ChannelOption#TCP_FASTOPEN_CONNECT is supported and configured). If data is written care must be taken to update the reader offset.

Returns:boolean

Doc from io.netty5.channel.AbstractChannel.doConnect.

true if the connect operation was completed, false if finishConnect() will be called later again to try finish connecting.

Annotations
@Override
doShutdownback to summary
protected void doShutdown(ChannelShutdownDirection direction)

Implements abstract io.netty5.channel.AbstractChannel.doShutdown.

Doc from io.netty5.channel.AbstractChannel.doShutdown.

Shutdown one direction of the Channel.

Parameters
direction:ChannelShutdownDirection

the direction to shut down.

Annotations
@Override
doWriteNowback to summary
protected void doWriteNow(AbstractChannel<UnixChannel, SocketAddress, SocketAddress>.WriteSink writeHandle)

Implements abstract io.netty5.channel.AbstractChannel.doWriteNow.

Doc from io.netty5.channel.AbstractChannel.doWriteNow.

Called in a loop when writes should be performed until this method returns false or there are no more messages to write. Implementations are responsible for handling partial writes, which for example means that if Buffers are written partial implementations need to ensure the readerOffset is updated accordingly.

Parameters
writeHandle:AbstractChannel<UnixChannel, SocketAddress, SocketAddress>.WriteSink

the WriteSink that must be completed with the write progress. WriteSink#complete(long, long, int, boolean) or WriteSink#complete(long, Throwable, boolean) must be called exactly once before this method returns non-exceptional.

Annotations
@Override
filterOutboundMessageback to summary
protected Object filterOutboundMessage(Object msg)

Overrides io.netty5.channel.AbstractChannel.filterOutboundMessage.

Doc from io.netty5.channel.AbstractChannel.filterOutboundMessage.

Invoked when a new message is added to to the outbound queue of this AbstractChannel, so that the Channel implementation converts the message to another. (e.g. heap buffer -> direct buffer)

Parameters
msg:Object

the message to filter / convert.

Annotations
@Override
getAcceptFilterback to summary
private AcceptFilter getAcceptFilter()
getBacklogback to summary
private int getBacklog()
getExtendedOptionback to summary
protected <T> T getExtendedOption(ChannelOption<T> option)

Overrides io.netty5.channel.kqueue.AbstractKQueueChannel.getExtendedOption.

Doc from io.netty5.channel.AbstractChannel.getExtendedOption.

Override to add support for more ChannelOptions. You need to also call super after handling the extra options.

Parameters
<T>
the value type.
option:ChannelOption<T>

the ChannelOption.

Returns:T

the value for the option.

Annotations
@SuppressWarnings:unchecked
@Override
getReceiveBufferSizeback to summary
private int getReceiveBufferSize()
isExtendedOptionSupportedback to summary
protected boolean isExtendedOptionSupported(ChannelOption<?> option)

Overrides io.netty5.channel.kqueue.AbstractKQueueChannel.isExtendedOptionSupported.

Doc from io.netty5.channel.AbstractChannel.isExtendedOptionSupported.

Override to add support for more ChannelOptions. You need to also call super after handling the extra options.

Parameters
option:ChannelOption<?>

the ChannelOption.

Returns:boolean

true if supported, false otherwise.

Annotations
@Override
isReuseAddressback to summary
private boolean isReuseAddress()
isReusePortback to summary
private boolean isReusePort()
isShutdownback to summary
public boolean isShutdown(ChannelShutdownDirection direction)

Implements io.netty5.channel.Channel.isShutdown.

Doc from io.netty5.channel.Channel.isShutdown.

Returns true if the ChannelShutdownDirection of the Channel was shutdown before.

Annotations
@Override
isSupportedback to summary
private boolean isSupported(SocketProtocolFamily protocolFamily, ChannelOption<?> option)
isTcpFastOpenback to summary
private boolean isTcpFastOpen()

Returns true if TCP FastOpen is enabled.

See Also
RFC 7413 Passive Open
newChildChannelback to summary
private Channel newChildChannel(int fd, byte[] address, int offset, int len) throws Exception
readReadyback to summary
pack-priv int readReady(AbstractChannel<UnixChannel, SocketAddress, SocketAddress>.ReadSink readSink) throws Exception

Implements abstract io.netty5.channel.kqueue.AbstractKQueueChannel.readReady.

Annotations
@Override
remoteAddress0back to summary
protected SocketAddress remoteAddress0()

Overrides io.netty5.channel.kqueue.AbstractKQueueChannel.remoteAddress0.

Doc from io.netty5.channel.AbstractChannel.remoteAddress0.

Return the SocketAddress which the Channel is connected to.

Returns:SocketAddress

the remote address if any, null otherwise.

Annotations
@Override
setAcceptFilterback to summary
private void setAcceptFilter(AcceptFilter acceptFilter)
setBacklogback to summary
private void setBacklog(int backlog)
setExtendedOptionback to summary
protected <T> void setExtendedOption(ChannelOption<T> option, T value)

Overrides io.netty5.channel.kqueue.AbstractKQueueChannel.setExtendedOption.

Doc from io.netty5.channel.AbstractChannel.setExtendedOption.

Override to add support for more ChannelOptions. You need to also call super after handling the extra options.

Parameters
<T>
the value type.
option:ChannelOption<T>

the ChannelOption.

Annotations
@Override
setReceiveBufferSizeback to summary
private void setReceiveBufferSize(int receiveBufferSize)
setReuseAddressback to summary
private void setReuseAddress(boolean reuseAddress)
setReusePortback to summary
private void setReusePort(boolean reusePort)
setTcpFastOpenback to summary
private void setTcpFastOpen(boolean enableTcpFastOpen)

Enables TCP FastOpen on the server channel. If the underlying os doesn't support TCP_FASTOPEN setting this has no effect. This has to be set before doing listen on the socket otherwise this takes no effect.

Parameters
enableTcpFastOpen:boolean

true if TCP FastOpen should be enabled for incomming connections.

See Also
RFC 7413 Passive Open
supportedOptionsback to summary
private static Set<ChannelOption<?>> supportedOptions()

Hides io.netty5.channel.AbstractChannel.supportedOptions.

supportedOptionsDomainSocketback to summary
private static Set<ChannelOption<?>> supportedOptionsDomainSocket()