Top Fields Constructors Methods
io.netty5.channel.kqueue

pack-priv abstract Class AbstractKQueueChannel<P extends UnixChannel>

extends AbstractChannel<P extends UnixChannel, SocketAddress, SocketAddress>
implements UnixChannel
Class Inheritance
All Implemented Interfaces
io.netty5.channel.unix.UnixChannel, io.netty5.channel.Channel, io.netty5.channel.IoHandle, java.lang.Comparable, io.netty5.channel.ChannelOutboundInvoker, io.netty5.util.concurrent.FuturePromiseFactory, io.netty5.util.AttributeMap
Known Direct Subclasses
io.netty5.channel.kqueue.KQueueDatagramChannel, io.netty5.channel.kqueue.KQueueServerSocketChannel, io.netty5.channel.kqueue.KQueueSocketChannel
Imports
io.netty5.buffer.Buffer, .BufferAllocator, .DefaultBufferAllocators, io.netty5.channel.ChannelOption, .ReadHandleFactory, .WriteHandleFactory, .AbstractChannel, .ChannelException, .EventLoop, io.netty5.channel.kqueue.KQueueReadHandleFactory.KQueueReadHandle, io.netty5.channel.socket.SocketProtocolFamily, io.netty5.channel.unix.IntegerUnixChannelOption, .RawUnixChannelOption, .FileDescriptor, .UnixChannel, io.netty5.util.Resource, java.io.IOException, java.net.InetSocketAddress, .SocketAddress, java.nio.ByteBuffer, java.nio.channels.UnresolvedAddressException

Field Summary

Modifier and TypeField and Description
protected volatile boolean
private boolean
private volatile SocketAddress
private boolean
private long
private boolean
private final Runnable
private boolean
private KQueueRegistration
private volatile SocketAddress
pack-priv final BsdSocket
private boolean

Constructor Summary

AccessConstructor and Description
pack-priv
AbstractKQueueChannel(P parent, EventLoop eventLoop, boolean supportsDisconnect, ReadHandleFactory defaultReadHandleFactory, WriteHandleFactory defaultWriteHandleFactory, BsdSocket fd, boolean active)

pack-priv
AbstractKQueueChannel(P parent, EventLoop eventLoop, boolean supportsDisconnect, ReadHandleFactory defaultReadHandleFactory, WriteHandleFactory defaultWriteHandleFactory, BsdSocket fd, SocketAddress remote)

Method Summary

Modifier and TypeMethod and Description
protected static void
pack-priv final void
pack-priv final void
protected void
doBind(SocketAddress
the SocketAddress to bound to.
local
)

Implements abstract io.netty5.channel.AbstractChannel.doBind.

Bind the Channel to the SocketAddress
protected final 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
)

Implements abstract io.netty5.channel.AbstractChannel.doConnect.

Connect to the remote peer
protected boolean
doConnect0(SocketAddress remoteAddress, SocketAddress localAddress, Buffer data)

protected void
doDisconnect()

Implements abstract io.netty5.channel.AbstractChannel.doDisconnect.

Disconnect this Channel from its remote peer
protected final boolean
doFinishConnect(SocketAddress
the remote address of the peer.
requestedRemoteAddress
)

Implements abstract io.netty5.channel.AbstractChannel.doFinishConnect.

Finish a connect request.
protected final void
doRead(boolean
true if a read was already pending when read() was called.
wasReadPendingAlready
)

Implements abstract io.netty5.channel.AbstractChannel.doRead.

Schedule a read operation.
protected final int
doReadBytes(Buffer buffer)

Read bytes into the given Buffer and return the amount.

protected boolean
doReadNow(AbstractChannel<P, SocketAddress, SocketAddress>.ReadSink
the ReadSink that should be called with messages that are read from the transport to propagate these.
readSink
)

Implements abstract io.netty5.channel.AbstractChannel.doReadNow.

Try to read a message from the transport and dispatch it via ReadSink#processRead(int, int, Object).
protected final int
private void
evSet(short filter, short flags)

private void
evSet0(KQueueRegistration registration, short filter, short flags)

private void
evSet0(KQueueRegistration registration, short filter, short flags, int fflags)

private void
public final FileDescriptor
fd()

Implements io.netty5.channel.unix.UnixChannel.fd.

Returns the FileDescriptor that is used by this Channel.
protected boolean
protected <T> T
private BufferAllocator
private static BufferAllocator
public boolean
isActive()

Implements io.netty5.channel.Channel.isActive.

Return true if the Channel is active and so connected.
protected boolean
public final boolean
isOpen()

Implements io.netty5.channel.Channel.isOpen.

Returns true if the Channel is open and may get active later
pack-priv static boolean
protected boolean
isWriteFlushedScheduled()

Overrides io.netty5.channel.AbstractChannel.isWriteFlushedScheduled.

Returns true if flushed messages should not be tried to write when calling flush().
protected SocketAddress
localAddress0()

Implements abstract io.netty5.channel.AbstractChannel.localAddress0.

Returns the SocketAddress which is bound locally.
protected final Buffer
newDirectBuffer(Buffer buf)

Returns an off-heap copy of, and then closes, the given Buffer.

protected final Buffer
newDirectBuffer(Resource<?> holder, Buffer buf)

Returns an off-heap copy of the given Buffer, and then closes the holder under the assumption that it owned (or was itself) the buffer.

protected BufferAllocator
readBufferAllocator()

Overrides io.netty5.channel.AbstractChannel.readBufferAllocator.

Return the BufferAllocator that is used to allocate Buffer that are used for reading.
pack-priv final void
pack-priv final void
readFilter(boolean readFilterEnabled)

protected void
readLoopComplete()

Overrides io.netty5.channel.AbstractChannel.readLoopComplete.

Called once the read loop completed for this Channel.
pack-priv final void
readReady(long numberBytesPending)

pack-priv abstract int
pack-priv final void
protected final KQueueRegistration
protected SocketAddress
remoteAddress0()

Implements abstract io.netty5.channel.AbstractChannel.remoteAddress0.

Return the SocketAddress which the Channel is connected to.
pack-priv final void
protected <T> void
setExtendedOption(ChannelOption<T> option, T value)

Overrides io.netty5.channel.AbstractChannel.setExtendedOption.

Override to add support for more ChannelOptions.
pack-priv final void
pack-priv final void
writeFilter(boolean writeFilterEnabled)

protected final void
writeLoopComplete(boolean
true if all messages were written during the write loop, false otherwise.
allWritten
)

Overrides io.netty5.channel.AbstractChannel.writeLoopComplete.

Called once the write loop completed.
pack-priv final void
Inherited from io.netty5.channel.AbstractChannel:
bufferAllocatorcacheAddressescloseFuturecloseTransportcompareTodoShutdowndoWriteNowequalsexecutorfilterOutboundMessagefinishConnectgetOptionhashCodeidisConnectPendingisOptionSupportedisReadPendingisRegisteredisSupportingDisconnectlocalAddressnewChannelPipelinenewSupportedIdentityOptionsSetparentpipelineprepareToClosereadHandlereadIfIsAutoReadreadNowremoteAddresssetOptionshutdownReadSidetoStringvalidateEventLoopGroupvalidateFileRegionwritableByteswriteFlushedwriteFlushedNowwriteHandle

Field Detail

activeback to summary
protected volatile boolean active
eofback to summary
private boolean eof
localAddressback to summary
private volatile SocketAddress localAddress

Hides io.netty5.channel.AbstractChannel.localAddress.

maybeMoreDataToReadback to summary
private boolean maybeMoreDataToRead
numberBytesPendingback to summary
private long numberBytesPending
readFilterEnabledback to summary
private boolean readFilterEnabled
readNowRunnableback to summary
private final Runnable readNowRunnable
readNowRunnablePendingback to summary
private boolean readNowRunnablePending
registrationback to summary
private KQueueRegistration registration
remoteAddressback to summary
private volatile SocketAddress remoteAddress

Hides io.netty5.channel.AbstractChannel.remoteAddress.

socketback to summary
pack-priv final BsdSocket socket
writeFilterEnabledback to summary
private boolean writeFilterEnabled

Constructor Detail

AbstractKQueueChannelback to summary
pack-priv AbstractKQueueChannel(P parent, EventLoop eventLoop, boolean supportsDisconnect, ReadHandleFactory defaultReadHandleFactory, WriteHandleFactory defaultWriteHandleFactory, BsdSocket fd, boolean active)
AbstractKQueueChannelback to summary
pack-priv AbstractKQueueChannel(P parent, EventLoop eventLoop, boolean supportsDisconnect, ReadHandleFactory defaultReadHandleFactory, WriteHandleFactory defaultWriteHandleFactory, BsdSocket fd, SocketAddress remote)

Method Detail

checkResolvableback to summary
protected static void checkResolvable(InetSocketAddress addr)
closeTransportNowback to summary
pack-priv final void closeTransportNow()
deregister0back to summary
pack-priv final void deregister0()
doBindback to summary
protected void doBind(SocketAddress local) throws Exception

Implements abstract io.netty5.channel.AbstractChannel.doBind.

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

Bind the Channel to the SocketAddress

Parameters
local:SocketAddress

the SocketAddress to bound to.

Annotations
@Override
Exceptions
Exception:
when an error happens.
doClearScheduledReadback to summary
protected final void doClearScheduledRead()

Overrides io.netty5.channel.AbstractChannel.doClearScheduledRead.

Doc from io.netty5.channel.AbstractChannel.doClearScheduledRead.

Clear any previous scheduled read. By default, this method does nothing but implementations might override it to add extra logic.

Annotations
@Override
doCloseback to summary
protected void doClose() throws Exception

Implements abstract io.netty5.channel.AbstractChannel.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

Implements abstract io.netty5.channel.AbstractChannel.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.

Exceptions
Exception:

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

thrown on error.

doConnect0back to summary
protected boolean doConnect0(SocketAddress remoteAddress, SocketAddress localAddress, Buffer data) throws Exception
doDisconnectback to summary
protected void doDisconnect() throws Exception

Implements abstract io.netty5.channel.AbstractChannel.doDisconnect.

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

Disconnect this Channel from its remote peer

Annotations
@Override
Exceptions
Exception:
thrown on error.
doFinishConnectback to summary
protected final boolean doFinishConnect(SocketAddress requestedRemoteAddress) throws Exception

Implements abstract io.netty5.channel.AbstractChannel.doFinishConnect.

Doc from io.netty5.channel.AbstractChannel.doFinishConnect.

Finish a connect request. This method should never be directly called, use finishConnect() instead.

Parameters
requestedRemoteAddress:SocketAddress

the remote address of the peer.

Returns:boolean

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

Annotations
@Override
Exceptions
Exception:
thrown on error.
doReadback to summary
protected final void doRead(boolean wasReadPendingAlready)

Implements abstract io.netty5.channel.AbstractChannel.doRead.

Doc from io.netty5.channel.AbstractChannel.doRead.

Schedule a read operation.

Parameters
wasReadPendingAlready:boolean

true if a read was already pending when read() was called.

Annotations
@Override
doReadBytesback to summary
protected final int doReadBytes(Buffer buffer) throws Exception

Read bytes into the given Buffer and return the amount.

doReadNowback to summary
protected boolean doReadNow(AbstractChannel<P, SocketAddress, SocketAddress>.ReadSink readSink) throws Exception

Implements abstract io.netty5.channel.AbstractChannel.doReadNow.

Doc from io.netty5.channel.AbstractChannel.doReadNow.

Try to read a message from the transport and dispatch it via ReadSink#processRead(int, int, Object). This method is called in a loop until there is nothing more messages to read or the channel was shutdown / closed. This method should never be called directly by sub-classes, use readNow() instead.

Parameters
readSink:AbstractChannel<P, SocketAddress, SocketAddress>.ReadSink

the ReadSink that should be called with messages that are read from the transport to propagate these.

Returns:boolean

true if the channel should be shutdown / closed.

Annotations
@Override
doWriteBytesback to summary
protected final int doWriteBytes(Buffer buf) throws Exception
evSetback to summary
private void evSet(short filter, short flags)
evSet0back to summary
private void evSet0(KQueueRegistration registration, short filter, short flags)
evSet0back to summary
private void evSet0(KQueueRegistration registration, short filter, short flags, int fflags)
executeReadNowRunnableback to summary
private void executeReadNowRunnable()
fdback to summary
public final FileDescriptor fd()

Implements io.netty5.channel.unix.UnixChannel.fd.

Doc from io.netty5.channel.unix.UnixChannel.fd.

Returns the FileDescriptor that is used by this Channel.

Annotations
@Override
fetchLocalAddressback to summary
protected boolean fetchLocalAddress()
getExtendedOptionback to summary
protected <T> T getExtendedOption(ChannelOption<T> option)

Overrides io.netty5.channel.AbstractChannel.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
@Override
@SuppressWarnings:unchecked
ioBufferAllocatorback to summary
private BufferAllocator ioBufferAllocator()
ioBufferAllocatorback to summary
private static BufferAllocator ioBufferAllocator(BufferAllocator alloc)
isActiveback to summary
public boolean 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
isExtendedOptionSupportedback to summary
protected boolean isExtendedOptionSupported(ChannelOption<?> option)

Overrides io.netty5.channel.AbstractChannel.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
isOpenback to summary
public final boolean isOpen()

Implements io.netty5.channel.Channel.isOpen.

Doc from io.netty5.channel.Channel.isOpen.

Returns true if the Channel is open and may get active later

Annotations
@Override
isSoErrorZeroback to summary
pack-priv static boolean isSoErrorZero(BsdSocket fd)
isWriteFlushedScheduledback to summary
protected boolean isWriteFlushedScheduled()

Overrides io.netty5.channel.AbstractChannel.isWriteFlushedScheduled.

Doc from io.netty5.channel.AbstractChannel.isWriteFlushedScheduled.

Returns true if flushed messages should not be tried to write when calling flush(). Instead these will be written once writeFlushedNow() is called, which is typically done once the underlying transport becomes writable again.

Returns:boolean

true if write will be done later on by calling writeFlushedNow(), false otherwise.

Annotations
@Override
localAddress0back to summary
protected SocketAddress localAddress0()

Implements abstract io.netty5.channel.AbstractChannel.localAddress0.

Doc from io.netty5.channel.AbstractChannel.localAddress0.

Returns the SocketAddress which is bound locally.

Returns:SocketAddress

the local address if any, null otherwise.

Annotations
@Override
newDirectBufferback to summary
protected final Buffer newDirectBuffer(Buffer buf)

Returns an off-heap copy of, and then closes, the given Buffer.

newDirectBufferback to summary
protected final Buffer newDirectBuffer(Resource<?> holder, Buffer buf)

Returns an off-heap copy of the given Buffer, and then closes the holder under the assumption that it owned (or was itself) the buffer.

readBufferAllocatorback to summary
protected BufferAllocator readBufferAllocator()

Overrides io.netty5.channel.AbstractChannel.readBufferAllocator.

Doc from io.netty5.channel.AbstractChannel.readBufferAllocator.

Return the BufferAllocator that is used to allocate Buffer that are used for reading. By default, this will just return bufferAllocator(). Sub-classes might override this if some special allocator is needed.

Returns:BufferAllocator

the BufferAllocator that is used to allocate Buffers that are used for reading.

Annotations
@Override
readEOFback to summary
pack-priv final void readEOF()
readFilterback to summary
pack-priv final void readFilter(boolean readFilterEnabled)
readLoopCompleteback to summary
protected void readLoopComplete()

Overrides io.netty5.channel.AbstractChannel.readLoopComplete.

Doc from io.netty5.channel.AbstractChannel.readLoopComplete.

Called once the read loop completed for this Channel. Sub-classes might override this method but should also call super.

Annotations
@Override
readReadyback to summary
pack-priv final void readReady(long numberBytesPending)
readReadyback to summary
pack-priv abstract int readReady(AbstractChannel<P, SocketAddress, SocketAddress>.ReadSink readSink) throws Exception
register0back to summary
pack-priv final void register0(KQueueRegistration registration)
registrationback to summary
protected final KQueueRegistration registration()
remoteAddress0back to summary
protected SocketAddress remoteAddress0()

Implements abstract io.netty5.channel.AbstractChannel.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
resetCachedAddressesback to summary
pack-priv final void resetCachedAddresses()
setExtendedOptionback to summary
protected <T> void setExtendedOption(ChannelOption<T> option, T value)

Overrides io.netty5.channel.AbstractChannel.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
unregisterFiltersback to summary
pack-priv final void unregisterFilters()
writeFilterback to summary
pack-priv final void writeFilter(boolean writeFilterEnabled)
writeLoopCompleteback to summary
protected final void writeLoopComplete(boolean allWritten)

Overrides io.netty5.channel.AbstractChannel.writeLoopComplete.

Doc from io.netty5.channel.AbstractChannel.writeLoopComplete.

Called once the write loop completed. Subclasses might override this method for custom logic but should also call super.

Parameters
allWritten:boolean

true if all messages were written during the write loop, false otherwise.

Annotations
@Override
writeReadyback to summary
pack-priv final void writeReady()