Top Inners Fields Constructors Methods
io.netty5.channel.epoll

pack-priv abstract Class AbstractEpollChannel<P extends io.netty5.channel.unix.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.epoll.EpollDatagramChannel, io.netty5.channel.epoll.EpollServerSocketChannel, io.netty5.channel.epoll.EpollSocketChannel
Imports
io.netty5.buffer.Buffer, .BufferAllocator, .DefaultBufferAllocators, io.netty5.channel.ChannelOption, .ReadHandleFactory, .WriteHandleFactory, .AbstractChannel, .ChannelException, .EventLoop, io.netty5.channel.socket.DomainSocketAddress, .SocketProtocolFamily, io.netty5.channel.unix.IntegerUnixChannelOption, .RawUnixChannelOption, .FileDescriptor, .IovArray, .Socket, .UnixChannel, io.netty5.util.Resource, java.io.IOException, .UncheckedIOException, java.net.InetSocketAddress, .SocketAddress, java.nio.ByteBuffer, java.nio.channels.UnresolvedAddressException

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static enum

Field Summary

Modifier and TypeField and Description
protected volatile boolean
private int
private volatile SocketAddress
private boolean
private final Runnable
private boolean
private boolean
private EpollRegistration
private volatile SocketAddress
protected final LinuxSocket

Constructor Summary

AccessConstructor and Description
pack-priv
AbstractEpollChannel(EventLoop eventLoop, boolean supportingDisconnect, int initialFlag, ReadHandleFactory defaultReadHandleFactory, WriteHandleFactory defaultWriteHandleFactory, LinuxSocket fd)

pack-priv
AbstractEpollChannel(P parent, EventLoop eventLoop, boolean supportingDisconnect, int initialFlag, ReadHandleFactory defaultReadHandleFactory, WriteHandleFactory defaultWriteHandleFactory, LinuxSocket fd, boolean active)

pack-priv
AbstractEpollChannel(P parent, EventLoop eventLoop, boolean supportingDisconnect, int initialFlag, ReadHandleFactory defaultReadHandleFactory, WriteHandleFactory defaultWriteHandleFactory, LinuxSocket fd, SocketAddress remote)

Method Summary

Modifier and TypeMethod and Description
protected static void
private void
clearEpollRdHup()

Clear the Native#EPOLLRDHUP flag from EPOLL, and close on failure.

protected final void
clearFlag(int flag)

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 remote, Buffer initialData)

protected void
doDisconnect()

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

Disconnect this Channel from its remote peer
protected 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
protected final long
doWriteOrSendBytes(Buffer data, SocketAddress remoteAddress, boolean fastOpen)

Write bytes to the socket, with or without a remote address.

pack-priv final void
protected abstract AbstractEpollChannel.ReadState
epollInReady(AbstractChannel<P, SocketAddress, SocketAddress>.ReadSink readSink)

Called once EPOLLIN event is ready to be processed

pack-priv final void
epollOutReady()

Called once a EPOLLOUT event is ready to be processed

pack-priv final void
epollRdHupReady()

Called once EPOLLRDHUP event is ready to be processed

private void
public final FileDescriptor
fd()

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

Returns the FileDescriptor that is used by this Channel.
protected final boolean
pack-priv final int
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
private boolean
isFlagSet(int flag)

public final boolean
isOpen()

Implements io.netty5.channel.Channel.isOpen.

Returns true if the Channel is open and may get active later
protected 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 final SocketAddress
localAddress0()

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

Returns the SocketAddress which is bound locally.
private void
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.
protected void
readLoopComplete()

Overrides io.netty5.channel.AbstractChannel.readLoopComplete.

Called once the read loop completed for this Channel.
pack-priv final void
protected final EpollRegistration
protected final 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.
protected final void
setFlag(int flag)

protected 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.
Inherited from io.netty5.channel.AbstractChannel:
bufferAllocatorcacheAddressescloseFuturecloseTransportcompareTodoShutdowndoWriteNowequalsexecutorfilterOutboundMessagefinishConnectgetOptionhashCodeidisConnectPendingisOptionSupportedisReadPendingisRegisteredisSupportingDisconnectlocalAddressnewChannelPipelinenewSupportedIdentityOptionsSetparentpipelineprepareToClosereadHandlereadIfIsAutoReadreadNowremoteAddresssetOptionshutdownReadSidetoStringvalidateEventLoopGroupvalidateFileRegionwritableByteswriteFlushedwriteFlushedNowwriteHandle

Field Detail

activeback to summary
protected volatile boolean active
flagsback to summary
private int flags
localAddressback to summary
private volatile SocketAddress localAddress

Hides io.netty5.channel.AbstractChannel.localAddress.

maybeMoreDataToReadback to summary
private boolean maybeMoreDataToRead
readNowRunnableback to summary
private final Runnable readNowRunnable
readNowRunnablePendingback to summary
private boolean readNowRunnablePending
receivedRdHupback to summary
private boolean receivedRdHup
registrationback to summary
private EpollRegistration registration
remoteAddressback to summary
private volatile SocketAddress remoteAddress

Hides io.netty5.channel.AbstractChannel.remoteAddress.

socketback to summary
protected final LinuxSocket socket

Constructor Detail

AbstractEpollChannelback to summary
pack-priv AbstractEpollChannel(EventLoop eventLoop, boolean supportingDisconnect, int initialFlag, ReadHandleFactory defaultReadHandleFactory, WriteHandleFactory defaultWriteHandleFactory, LinuxSocket fd)
AbstractEpollChannelback to summary
pack-priv AbstractEpollChannel(P parent, EventLoop eventLoop, boolean supportingDisconnect, int initialFlag, ReadHandleFactory defaultReadHandleFactory, WriteHandleFactory defaultWriteHandleFactory, LinuxSocket fd, boolean active)
AbstractEpollChannelback to summary
pack-priv AbstractEpollChannel(P parent, EventLoop eventLoop, boolean supportingDisconnect, int initialFlag, ReadHandleFactory defaultReadHandleFactory, WriteHandleFactory defaultWriteHandleFactory, LinuxSocket fd, SocketAddress remote)

Method Detail

checkResolvableback to summary
protected static void checkResolvable(InetSocketAddress addr)
clearEpollRdHupback to summary
private void clearEpollRdHup()

Clear the Native#EPOLLRDHUP flag from EPOLL, and close on failure.

clearFlagback to summary
protected final void clearFlag(int flag) throws IOException
closeTransportNowback to summary
pack-priv final void closeTransportNow()
deregister0back to summary
pack-priv final void deregister0() throws Exception
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 remote, Buffer initialData) 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 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) throws Exception

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
Exceptions
Exception:
thrown on error.
doReadBytesback to summary
protected final int doReadBytes(Buffer buffer) throws Exception

Read bytes into the given Buffer and return the amount. This method does not modify the offset of the buffer.

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
doWriteOrSendBytesback to summary
protected final long doWriteOrSendBytes(Buffer data, SocketAddress remoteAddress, boolean fastOpen) throws IOException

Write bytes to the socket, with or without a remote address. Used for datagram and TCP client fast open writes.

epollInReadyback to summary
pack-priv final void epollInReady()
epollInReadyback to summary
protected abstract AbstractEpollChannel.ReadState epollInReady(AbstractChannel<P, SocketAddress, SocketAddress>.ReadSink readSink) throws Exception

Called once EPOLLIN event is ready to be processed

epollOutReadyback to summary
pack-priv final void epollOutReady()

Called once a EPOLLOUT event is ready to be processed

epollRdHupReadyback to summary
pack-priv final void epollRdHupReady()

Called once EPOLLRDHUP event is ready to be processed

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 final boolean fetchLocalAddress()
flagsback to summary
pack-priv final int flags()
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
@SuppressWarnings:unchecked
@Override
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
isFlagSetback to summary
private boolean isFlagSet(int flag)
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
protected static boolean isSoErrorZero(Socket 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 final 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
modifyEventsback to summary
private void modifyEvents() throws IOException
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
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
register0back to summary
pack-priv final void register0(EpollRegistration registration)
registrationback to summary
protected final EpollRegistration registration()
remoteAddress0back to summary
protected final 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
setFlagback to summary
protected final void setFlag(int flag) throws IOException
writeLoopCompleteback to summary
protected 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
io.netty5.channel.epoll back to summary

pack-priv final Enum AbstractEpollChannel.ReadState

extends Enum<AbstractEpollChannel.ReadState>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final AbstractEpollChannel.ReadState
public static final AbstractEpollChannel.ReadState
public static final AbstractEpollChannel.ReadState

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static AbstractEpollChannel.ReadState
public static AbstractEpollChannel.ReadState[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

Allback to summary
public static final AbstractEpollChannel.ReadState All
Closedback to summary
public static final AbstractEpollChannel.ReadState Closed
Partialback to summary
public static final AbstractEpollChannel.ReadState Partial

Constructor Detail

ReadStateback to summary
private ReadState()

Method Detail

valueOfback to summary
public static AbstractEpollChannel.ReadState valueOf(String name)
valuesback to summary
public static AbstractEpollChannel.ReadState[] values()