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

public final Class KQueueDatagramChannel

extends AbstractKQueueChannel<UnixChannel>
implements DatagramChannel
Class Inheritance
All Implemented Interfaces
io.netty5.channel.socket.DatagramChannel, 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.AddressedEnvelope, .ChannelException, .ChannelOption, .ChannelShutdownDirection, .DefaultBufferAddressedEnvelope, .EventLoop, .FixedReadHandleFactory, .MaxMessagesWriteHandleFactory, io.netty5.channel.socket.DatagramChannel, .DatagramPacket, .DomainSocketAddress, .SocketProtocolFamily, io.netty5.channel.unix.DatagramSocketAddress, .DomainDatagramSocketAddress, .Errors, .IntegerUnixChannelOption, .IovArray, .RawUnixChannelOption, .UnixChannel, .UnixChannelOption, .UnixChannelUtil, io.netty5.util.concurrent.Future, io.netty5.util.internal.SilentDispose, .StringUtil, .UnstableApi, io.netty5.util.internal.logging.InternalLogger, .InternalLoggerFactory, java.io.IOException, java.net.InetAddress, .InetSocketAddress, .NetworkInterface, .PortUnreachableException, .ProtocolFamily, .SocketAddress, java.nio.ByteBuffer, java.util.Set

DatagramChannel implementation that uses KQueue.

Available options

In addition to the options provided by DatagramChannel and UnixChannel, KQueueDatagramChannel allows the following options in the option map:
ChannelOption INET INET6 UNIX
IntegerUnixChannelOptionXXX
RawUnixChannelOptionXXX
UnixChannelOption#SO_REUSEPORTXX-

Field Summary

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

Constructor Summary

AccessConstructor and Description
public
public
KQueueDatagramChannel(EventLoop eventLoop, ProtocolFamily protocolFamily)

public
KQueueDatagramChannel(EventLoop eventLoop, int fd, ProtocolFamily protocolFamily)

pack-priv
KQueueDatagramChannel(EventLoop eventLoop, BsdSocket socket, boolean active)

Method Summary

Modifier and TypeMethod and Description
public Future<Void>
block(InetAddress
the multicast group address.
multicastAddress
,
NetworkInterface
the interface to use.
networkInterface
,
InetAddress
the source address.
sourceToBlock
)

Implements io.netty5.channel.socket.DatagramChannel.block.

Block the given sourceToBlock address for the given multicastAddress on the given networkInterface and notifies the Future once the operation completes.
public Future<Void>
block(InetAddress
the multicast group address.
multicastAddress
,
InetAddress
the source address.
sourceToBlock
)

Implements io.netty5.channel.socket.DatagramChannel.block.

Block the given sourceToBlock address for the given multicastAddress and notifies the Future once the operation completes.
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
doDisconnect()

Overrides io.netty5.channel.kqueue.AbstractKQueueChannel.doDisconnect.

Disconnect this Channel from its 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.
writeSink
)

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 Object
filterOutboundMessage0(Object msg, Class<? extends SocketAddress> recipientClass, String expectedTypes)

private boolean
protected <T> T
private int
private int
private int
public boolean
isActive()

Overrides io.netty5.channel.kqueue.AbstractKQueueChannel.isActive.

Implements io.netty5.channel.Channel.isActive.

Return true if the Channel is active and so connected.
private boolean
public boolean
isConnected()

Implements io.netty5.channel.socket.DatagramChannel.isConnected.

Return true if the DatagramChannel is connected to the remote peer.
protected boolean
private boolean
private boolean
isReusePort()

Returns true if the SO_REUSEPORT option is set.

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)

public Future<Void>
joinGroup(InetAddress
the multicast group address.
multicastAddress
)

Implements io.netty5.channel.socket.DatagramChannel.joinGroup.

Joins a multicast group and notifies the Future once the operation completes.
public Future<Void>
joinGroup(InetAddress
the multicast group address.
multicastAddress
,
NetworkInterface
the interface to use.
networkInterface
,
InetAddress
the source address (might be null).
source
)

Implements io.netty5.channel.socket.DatagramChannel.joinGroup.

Joins the specified multicast group at the specified interface and notifies the Future once the operation completes.
public Future<Void>
leaveGroup(InetAddress
the multicast group address.
multicastAddress
)

Implements io.netty5.channel.socket.DatagramChannel.leaveGroup.

Leaves a multicast group and notifies the Future once the operation completes.
public Future<Void>
leaveGroup(InetAddress
the multicast group address.
multicastAddress
,
NetworkInterface
the interface to use.
networkInterface
,
InetAddress
the source address (might be null).
source
)

Implements io.netty5.channel.socket.DatagramChannel.leaveGroup.

Leave the specified multicast group at the specified interface using the specified source and notifies the Future once the operation completes.
private <V> Future<V>
pack-priv int
private void
setActiveOnOpen(boolean activeOnOpen)

private void
setBroadcast(boolean broadcast)

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

private void
setReuseAddress(boolean reuseAddress)

private void
setReusePort(boolean reusePort)

Set the SO_REUSEPORT option on the underlying Channel.

public void
setSendBufferSize(int sendBufferSize)

private void
setTrafficClass(int trafficClass)

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

Field Detail

activeOnOpenback to summary
private boolean activeOnOpen
connectedback to summary
private volatile boolean connected
EXPECTED_TYPESback to summary
private static final String EXPECTED_TYPES
EXPECTED_TYPES_DOMAINback to summary
private static final String EXPECTED_TYPES_DOMAIN
inputShutdownback to summary
private volatile boolean inputShutdown
loggerback to summary
private static final InternalLogger logger

Hides io.netty5.channel.AbstractChannel.logger.

outputShutdownback to summary
private volatile boolean outputShutdown
SUPPORTED_OPTIONSback to summary
private static final Set<ChannelOption<?>> SUPPORTED_OPTIONS
SUPPORTED_OPTIONS_DOMAIN_SOCKETback to summary
private static final Set<ChannelOption<?>> SUPPORTED_OPTIONS_DOMAIN_SOCKET

Constructor Detail

KQueueDatagramChannelback to summary
public KQueueDatagramChannel(EventLoop eventLoop)
KQueueDatagramChannelback to summary
public KQueueDatagramChannel(EventLoop eventLoop, ProtocolFamily protocolFamily)
KQueueDatagramChannelback to summary
public KQueueDatagramChannel(EventLoop eventLoop, int fd, ProtocolFamily protocolFamily)
KQueueDatagramChannelback to summary
pack-priv KQueueDatagramChannel(EventLoop eventLoop, BsdSocket socket, boolean active)

Method Detail

blockback to summary
public Future<Void> block(InetAddress multicastAddress, NetworkInterface networkInterface, InetAddress sourceToBlock)

Implements io.netty5.channel.socket.DatagramChannel.block.

Doc from io.netty5.channel.socket.DatagramChannel.block.

Block the given sourceToBlock address for the given multicastAddress on the given networkInterface and notifies the Future once the operation completes.

If the underlying implementation does not support this operation it will return a Future which is failed with an UnsupportedOperationException.

Parameters
multicastAddress:InetAddress

the multicast group address.

networkInterface:NetworkInterface

the interface to use.

sourceToBlock:InetAddress

the source address.

Returns:Future<Void>

a Future which is notified once the operation completes.

Annotations
@Override
blockback to summary
public Future<Void> block(InetAddress multicastAddress, InetAddress sourceToBlock)

Implements io.netty5.channel.socket.DatagramChannel.block.

Doc from io.netty5.channel.socket.DatagramChannel.block.

Block the given sourceToBlock address for the given multicastAddress and notifies the Future once the operation completes.

If the underlying implementation does not support this operation it will return a Future which is failed with an UnsupportedOperationException.

Parameters
multicastAddress:InetAddress

the multicast group address.

sourceToBlock:InetAddress

the source address.

Returns:Future<Void>

a Future which is notified once the operation completes.

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) throws Exception

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
Exceptions
Exception:

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

thrown on error.

doDisconnectback to summary
protected void doDisconnect() throws Exception

Overrides io.netty5.channel.kqueue.AbstractKQueueChannel.doDisconnect.

Doc from io.netty5.channel.AbstractChannel.doDisconnect.

Disconnect this Channel from its remote peer

Annotations
@Override
Exceptions
Exception:
thrown on error.
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 writeSink)

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
writeSink: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
filterOutboundMessage0back to summary
private Object filterOutboundMessage0(Object msg, Class<? extends SocketAddress> recipientClass, String expectedTypes)
getActiveOnOpenback to summary
private boolean getActiveOnOpen()
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()
getSendBufferSizeback to summary
private int getSendBufferSize()
getTrafficClassback to summary
private int getTrafficClass()
isActiveback to summary
public boolean isActive()

Overrides io.netty5.channel.kqueue.AbstractKQueueChannel.isActive.

Implements io.netty5.channel.Channel.isActive.

Doc from io.netty5.channel.Channel.isActive.

Return true if the Channel is active and so connected.

Annotations
@Override
isBroadcastback to summary
private boolean isBroadcast()
isConnectedback to summary
public boolean isConnected()

Implements io.netty5.channel.socket.DatagramChannel.isConnected.

Doc from io.netty5.channel.socket.DatagramChannel.isConnected.

Return true if the DatagramChannel is connected to the remote peer.

Annotations
@Override
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()

Returns true if the SO_REUSEPORT option is set.

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)
joinGroupback to summary
public Future<Void> joinGroup(InetAddress multicastAddress)

Implements io.netty5.channel.socket.DatagramChannel.joinGroup.

Doc from io.netty5.channel.socket.DatagramChannel.joinGroup.

Joins a multicast group and notifies the Future once the operation completes.

If the underlying implementation does not support this operation it will return a Future which is failed with an UnsupportedOperationException.

Parameters
multicastAddress:InetAddress

the multicast group address.

Returns:Future<Void>

a Future which is notified once the operation completes.

Annotations
@Override
joinGroupback to summary
public Future<Void> joinGroup(InetAddress multicastAddress, NetworkInterface networkInterface, InetAddress source)

Implements io.netty5.channel.socket.DatagramChannel.joinGroup.

Doc from io.netty5.channel.socket.DatagramChannel.joinGroup.

Joins the specified multicast group at the specified interface and notifies the Future once the operation completes.

If the underlying implementation does not support this operation it will return a Future which is failed with an UnsupportedOperationException.

Parameters
multicastAddress:InetAddress

the multicast group address.

networkInterface:NetworkInterface

the interface to use.

source:InetAddress

the source address (might be null).

Returns:Future<Void>

a Future which is notified once the operation completes.

Annotations
@Override
leaveGroupback to summary
public Future<Void> leaveGroup(InetAddress multicastAddress)

Implements io.netty5.channel.socket.DatagramChannel.leaveGroup.

Doc from io.netty5.channel.socket.DatagramChannel.leaveGroup.

Leaves a multicast group and notifies the Future once the operation completes.

If the underlying implementation does not support this operation it will return a Future which is failed with an UnsupportedOperationException.

Parameters
multicastAddress:InetAddress

the multicast group address.

Returns:Future<Void>

a Future which is notified once the operation completes.

Annotations
@Override
leaveGroupback to summary
public Future<Void> leaveGroup(InetAddress multicastAddress, NetworkInterface networkInterface, InetAddress source)

Implements io.netty5.channel.socket.DatagramChannel.leaveGroup.

Doc from io.netty5.channel.socket.DatagramChannel.leaveGroup.

Leave the specified multicast group at the specified interface using the specified source and notifies the Future once the operation completes.

If the underlying implementation does not support this operation it will return a Future which is failed with an UnsupportedOperationException.

Parameters
multicastAddress:InetAddress

the multicast group address.

networkInterface:NetworkInterface

the interface to use.

source:InetAddress

the source address (might be null).

Returns:Future<Void>

a Future which is notified once the operation completes.

Annotations
@Override
newMulticastNotSupportedFutureback to summary
private <V> Future<V> newMulticastNotSupportedFuture()
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
setActiveOnOpenback to summary
private void setActiveOnOpen(boolean activeOnOpen)
setBroadcastback to summary
private void setBroadcast(boolean broadcast)
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)

Set the SO_REUSEPORT option on the underlying Channel. This will allow to bind multiple KQueueSocketChannels to the same port and so accept connections with multiple threads. Be aware this method needs be called before KQueueDatagramChannel#bind(java.net.SocketAddress) to have any affect.

setSendBufferSizeback to summary
public void setSendBufferSize(int sendBufferSize)
setTrafficClassback to summary
private void setTrafficClass(int trafficClass)
supportedOptionsback to summary
private static Set<ChannelOption<?>> supportedOptions()

Hides io.netty5.channel.AbstractChannel.supportedOptions.

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