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

pack-priv abstract Class AbstractEpollChannel

extends AbstractChannel
implements UnixChannel
Class Inheritance
All Implemented Interfaces
io.netty.channel.unix.UnixChannel, io.netty.channel.Channel, java.lang.Comparable, io.netty.channel.ChannelOutboundInvoker, io.netty.util.AttributeMap
Known Direct Subclasses
io.netty.channel.epoll.AbstractEpollServerChannel, io.netty.channel.epoll.AbstractEpollStreamChannel, io.netty.channel.epoll.EpollDatagramChannel, io.netty.channel.epoll.EpollDomainDatagramChannel
Imports
io.netty.buffer.ByteBuf, .ByteBufAllocator, .ByteBufUtil, .Unpooled, io.netty.channel.AbstractChannel, .Channel, .ChannelConfig, .ChannelException, .ChannelFuture, .ChannelFutureListener, .ChannelMetadata, .ChannelOutboundBuffer, .ChannelPromise, .ConnectTimeoutException, .EventLoop, .RecvByteBufAllocator, io.netty.channel.socket.ChannelInputShutdownEvent, .ChannelInputShutdownReadComplete, .SocketChannelConfig, io.netty.channel.unix.FileDescriptor, .IovArray, .Socket, .UnixChannel, io.netty.util.ReferenceCountUtil, io.netty.util.concurrent.Future, java.io.IOException, java.net.InetSocketAddress, .SocketAddress, java.nio.ByteBuffer, java.nio.channels.AlreadyConnectedException, .ClosedChannelException, .ConnectionPendingException, .NotYetConnectedException, .UnresolvedAddressException, java.util.concurrent.TimeUnit

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected abstract class

Field Summary

Modifier and TypeField and Description
protected volatile boolean
private ChannelPromise
connectPromise

The future of the current connection attempt.

private Future<?>
pack-priv boolean
protected int
pack-priv boolean
private volatile SocketAddress
private static final ChannelMetadata
private volatile SocketAddress
private SocketAddress
protected final LinuxSocket

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
AbstractEpollChannel(Channel parent, LinuxSocket fd, boolean active)

pack-priv

Method Summary

Modifier and TypeMethod and Description
protected static void
pack-priv final void
pack-priv void
clearFlag(int flag)

public abstract EpollChannelConfig
config()

Redeclares io.netty.channel.Channel.config.

Returns the configuration of this channel.
protected final void
doBeginRead()

Implements abstract io.netty.channel.AbstractChannel.doBeginRead.

Schedule a read operation.
protected void
protected void
protected boolean
doConnect(SocketAddress remoteAddress, SocketAddress localAddress)

Connect to the remote peer

pack-priv boolean
protected void
protected void
doDisconnect()

Implements abstract io.netty.channel.AbstractChannel.doDisconnect.

Disconnect this Channel from its remote peer
protected final int
doReadBytes(ByteBuf byteBuf)

Read bytes into the given ByteBuf and return the amount.

protected void
doRegister()

Overrides io.netty.channel.AbstractChannel.doRegister.

Is called after the Channel is registered with its EventLoop as part of the register process.
protected final int
pack-priv final long
doWriteOrSendBytes(ByteBuf data, InetSocketAddress remoteAddress, boolean fastOpen)

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

public final FileDescriptor
fd()

Implements io.netty.channel.unix.UnixChannel.fd.

Returns the FileDescriptor that is used by this Channel.
public boolean
isActive()

Implements io.netty.channel.Channel.isActive.

Return true if the Channel is active and so connected.
private static boolean
protected boolean
isCompatible(EventLoop loop)

Implements abstract io.netty.channel.AbstractChannel.isCompatible.

Return true if the given EventLoop is compatible with this instance.
pack-priv boolean
isFlagSet(int flag)

public boolean
isOpen()

Implements io.netty.channel.Channel.isOpen.

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

Implements abstract io.netty.channel.AbstractChannel.localAddress0.

Returns the SocketAddress which is bound locally.
public ChannelMetadata
metadata()

Implements io.netty.channel.Channel.metadata.

Return the ChannelMetadata of the Channel which describe the nature of the Channel.
private void
protected final ByteBuf
newDirectBuffer(ByteBuf buf)

Returns an off-heap copy of the specified ByteBuf, and releases the original one.

protected final ByteBuf
newDirectBuffer(Object holder, ByteBuf buf)

Returns an off-heap copy of the specified ByteBuf, and releases the specified holder.

private static ByteBuf
newDirectBuffer0(Object holder, ByteBuf buf, ByteBufAllocator alloc, int capacity)

protected abstract AbstractEpollChannel.AbstractEpollUnsafe
newUnsafe()

Implements abstract io.netty.channel.AbstractChannel.newUnsafe.

Create a new AbstractUnsafe instance which will be used for the life-time of the Channel
protected SocketAddress
remoteAddress0()

Implements abstract io.netty.channel.AbstractChannel.remoteAddress0.

Return the SocketAddress which the Channel is connected to.
pack-priv void
protected void
setFlag(int flag)

pack-priv final boolean
Inherited from io.netty.channel.AbstractChannel:
allocbindbindbytesBeforeUnwritablebytesBeforeWritablecloseclosecloseFuturecompareToconnectconnectconnectconnectderegisterderegisterdisconnectdisconnectdoShutdownOutputdoWriteequalseventLoopfilterOutboundMessageflushhashCodeidinvalidateLocalAddressinvalidateRemoteAddressisRegisteredisWritablelocalAddressmaxMessagesPerWritenewChannelPipelinenewFailedFuturenewIdnewProgressivePromisenewPromisenewSucceededFutureparentpipelinereadremoteAddresstoStringunsafevalidateFileRegionvoidPromisewritewritewriteAndFlushwriteAndFlush

Field Detail

activeback to summary
protected volatile boolean active
connectPromiseback to summary
private ChannelPromise connectPromise

The future of the current connection attempt. If not null, subsequent connection attempts will fail.

connectTimeoutFutureback to summary
private Future<?> connectTimeoutFuture
epollInReadyRunnablePendingback to summary
pack-priv boolean epollInReadyRunnablePending
flagsback to summary
protected int flags
inputClosedSeenErrorOnReadback to summary
pack-priv boolean inputClosedSeenErrorOnRead
localback to summary
private volatile SocketAddress local
METADATAback to summary
private static final ChannelMetadata METADATA
remoteback to summary
private volatile SocketAddress remote
requestedRemoteAddressback to summary
private SocketAddress requestedRemoteAddress
socketback to summary
protected final LinuxSocket socket

Constructor Detail

AbstractEpollChannelback to summary
pack-priv AbstractEpollChannel(LinuxSocket fd)
AbstractEpollChannelback to summary
pack-priv AbstractEpollChannel(Channel parent, LinuxSocket fd, boolean active)
AbstractEpollChannelback to summary
pack-priv AbstractEpollChannel(Channel parent, LinuxSocket fd, SocketAddress remote)

Method Detail

checkResolvableback to summary
protected static void checkResolvable(InetSocketAddress addr)
clearEpollInback to summary
pack-priv final void clearEpollIn()
clearFlagback to summary
pack-priv void clearFlag(int flag) throws IOException
configback to summary
public abstract EpollChannelConfig config()

Redeclares io.netty.channel.Channel.config.

Doc from io.netty.channel.Channel.config.

Returns the configuration of this channel.

Annotations
@Override
doBeginReadback to summary
protected final void doBeginRead() throws Exception

Implements abstract io.netty.channel.AbstractChannel.doBeginRead.

Doc from io.netty.channel.AbstractChannel.doBeginRead.

Schedule a read operation.

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

Implements abstract io.netty.channel.AbstractChannel.doBind.

Doc from io.netty.channel.AbstractChannel.doBind.

Bind the Channel to the SocketAddress

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

Implements abstract io.netty.channel.AbstractChannel.doClose.

Doc from io.netty.channel.AbstractChannel.doClose.

Close the Channel

Annotations
@Override
doConnectback to summary
protected boolean doConnect(SocketAddress remoteAddress, SocketAddress localAddress) throws Exception

Connect to the remote peer

doConnect0back to summary
pack-priv boolean doConnect0(SocketAddress remote) throws Exception
doDeregisterback to summary
protected void doDeregister() throws Exception

Overrides io.netty.channel.AbstractChannel.doDeregister.

Doc from io.netty.channel.AbstractChannel.doDeregister.

Deregister the Channel from its EventLoop. Sub-classes may override this method

Annotations
@Override
doDisconnectback to summary
protected void doDisconnect() throws Exception

Implements abstract io.netty.channel.AbstractChannel.doDisconnect.

Doc from io.netty.channel.AbstractChannel.doDisconnect.

Disconnect this Channel from its remote peer

Annotations
@Override
doReadBytesback to summary
protected final int doReadBytes(ByteBuf byteBuf) throws Exception

Read bytes into the given ByteBuf and return the amount.

doRegisterback to summary
protected void doRegister() throws Exception

Overrides io.netty.channel.AbstractChannel.doRegister.

Doc from io.netty.channel.AbstractChannel.doRegister.

Is called after the Channel is registered with its EventLoop as part of the register process. Sub-classes may override this method

Annotations
@Override
doWriteBytesback to summary
protected final int doWriteBytes(ChannelOutboundBuffer in, ByteBuf buf) throws Exception
doWriteOrSendBytesback to summary
pack-priv final long doWriteOrSendBytes(ByteBuf data, InetSocketAddress 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.

fdback to summary
public final FileDescriptor fd()

Implements io.netty.channel.unix.UnixChannel.fd.

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

Returns the FileDescriptor that is used by this Channel.

Annotations
@Override
isActiveback to summary
public boolean isActive()

Implements io.netty.channel.Channel.isActive.

Doc from io.netty.channel.Channel.isActive.

Return true if the Channel is active and so connected.

Annotations
@Override
isAllowHalfClosureback to summary
private static boolean isAllowHalfClosure(ChannelConfig config)
isCompatibleback to summary
protected boolean isCompatible(EventLoop loop)

Implements abstract io.netty.channel.AbstractChannel.isCompatible.

Doc from io.netty.channel.AbstractChannel.isCompatible.

Return true if the given EventLoop is compatible with this instance.

Annotations
@Override
isFlagSetback to summary
pack-priv boolean isFlagSet(int flag)
isOpenback to summary
public boolean isOpen()

Implements io.netty.channel.Channel.isOpen.

Doc from io.netty.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(Socket fd)
localAddress0back to summary
protected SocketAddress localAddress0()

Implements abstract io.netty.channel.AbstractChannel.localAddress0.

Doc from io.netty.channel.AbstractChannel.localAddress0.

Returns the SocketAddress which is bound locally.

Annotations
@Override
metadataback to summary
public ChannelMetadata metadata()

Implements io.netty.channel.Channel.metadata.

Doc from io.netty.channel.Channel.metadata.

Return the ChannelMetadata of the Channel which describe the nature of the Channel.

Annotations
@Override
modifyEventsback to summary
private void modifyEvents() throws IOException
newDirectBufferback to summary
protected final ByteBuf newDirectBuffer(ByteBuf buf)

Returns an off-heap copy of the specified ByteBuf, and releases the original one.

newDirectBufferback to summary
protected final ByteBuf newDirectBuffer(Object holder, ByteBuf buf)

Returns an off-heap copy of the specified ByteBuf, and releases the specified holder. The caller must ensure that the holder releases the original ByteBuf when the holder is released by this method.

newDirectBuffer0back to summary
private static ByteBuf newDirectBuffer0(Object holder, ByteBuf buf, ByteBufAllocator alloc, int capacity)
newUnsafeback to summary
protected abstract AbstractEpollChannel.AbstractEpollUnsafe newUnsafe()

Implements abstract io.netty.channel.AbstractChannel.newUnsafe.

Doc from io.netty.channel.AbstractChannel.newUnsafe.

Create a new AbstractUnsafe instance which will be used for the life-time of the Channel

Annotations
@Override
remoteAddress0back to summary
protected SocketAddress remoteAddress0()

Implements abstract io.netty.channel.AbstractChannel.remoteAddress0.

Doc from io.netty.channel.AbstractChannel.remoteAddress0.

Return the SocketAddress which the Channel is connected to.

Annotations
@Override
resetCachedAddressesback to summary
pack-priv void resetCachedAddresses()
setFlagback to summary
protected void setFlag(int flag) throws IOException
shouldBreakEpollInReadyback to summary
pack-priv final boolean shouldBreakEpollInReady(ChannelConfig config)
io.netty.channel.epoll back to summary

protected abstract Class AbstractEpollChannel.AbstractEpollUnsafe

extends AbstractUnsafe
Class Inheritance
Known Direct Subclasses
io.netty.channel.epoll.AbstractEpollServerChannel.EpollServerSocketUnsafe, io.netty.channel.epoll.AbstractEpollStreamChannel.EpollStreamUnsafe, io.netty.channel.epoll.EpollDatagramChannel.EpollDatagramChannelUnsafe, io.netty.channel.epoll.EpollDomainDatagramChannel.EpollDomainDatagramChannelUnsafe

Field Summary

Modifier and TypeField and Description
private EpollRecvByteAllocatorHandle
allocHandle

Deprecated as a consequence of EpollRecvByteAllocatorHandle being deprecated.
private final Runnable
pack-priv boolean
pack-priv boolean

Constructor Summary

AccessConstructor and Description
protected

Method Summary

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

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

public void
connect(final SocketAddress remoteAddress, final SocketAddress localAddress, final ChannelPromise promise)

Implements io.netty.channel.Channel.Unsafe.connect.

Connect the Channel of the given ChannelFuture with the given remote SocketAddress.
private boolean
doFinishConnect()

Finish the connect

pack-priv final void
pack-priv final void
pack-priv abstract void
epollInReady()

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

pack-priv final void
private void
private void
protected final void
private void
fulfillConnectPromise(ChannelPromise promise, boolean wasActive)

private void
pack-priv EpollRecvByteAllocatorHandle
newEpollHandle(RecvByteBufAllocator.ExtendedHandle
The handle to wrap with EPOLL specific logic.
handle
)

Deprecated as a consequence of RecvByteBufAllocator.ExtendedHandle and EpollRecvByteAllocatorHandle being deprecated.
Create a new EpollRecvByteAllocatorHandle instance.
public EpollRecvByteAllocatorHandle
recvBufAllocHandle()

Overrides io.netty.channel.AbstractChannel.AbstractUnsafe.recvBufAllocHandle.

Implements io.netty.channel.Channel.Unsafe.recvBufAllocHandle.

Deprecated as a consequence of EpollRecvByteAllocatorHandle being deprecated.
Return the assigned RecvByteBufAllocator.Handle which will be used to allocate ByteBuf's when receiving data.
pack-priv void
shutdownInput(boolean rdHup)

Shutdown the input side of the channel.

Inherited from io.netty.channel.AbstractChannel.AbstractUnsafe:
annotateConnectExceptionbeginReadbindclosecloseForciblycloseIfClosedderegisterdisconnectensureOpenflushhandleWriteErrorlocalAddressoutboundBufferprepareToCloseregisterremoteAddresssafeSetFailuresafeSetSuccessshutdownOutputvoidPromisewrite

Field Detail

allocHandleback to summary
private EpollRecvByteAllocatorHandle allocHandle

Deprecated

as a consequence of EpollRecvByteAllocatorHandle being deprecated. See corresponding docs for further information.

epollInReadyRunnableback to summary
private final Runnable epollInReadyRunnable
maybeMoreDataToReadback to summary
pack-priv boolean maybeMoreDataToRead
readPendingback to summary
pack-priv boolean readPending

Constructor Detail

AbstractEpollUnsafeback to summary
protected AbstractEpollUnsafe()

Method Detail

clearEpollIn0back to summary
protected final void clearEpollIn0()
clearEpollRdHupback to summary
private void clearEpollRdHup()

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

connectback to summary
public void connect(final SocketAddress remoteAddress, final SocketAddress localAddress, final ChannelPromise promise)

Implements io.netty.channel.Channel.Unsafe.connect.

Doc from io.netty.channel.Channel.Unsafe.connect.

Connect the Channel of the given ChannelFuture with the given remote SocketAddress. If a specific local SocketAddress should be used it need to be given as argument. Otherwise just pass null to it. The ChannelPromise will get notified once the connect operation was complete.

Annotations
@Override
doFinishConnectback to summary
private boolean doFinishConnect() throws Exception

Finish the connect

epollInBeforeback to summary
pack-priv final void epollInBefore()
epollInFinallyback to summary
pack-priv final void epollInFinally(ChannelConfig config)
epollInReadyback to summary
pack-priv abstract void epollInReady()

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

executeEpollInReadyRunnableback to summary
pack-priv final void executeEpollInReadyRunnable(ChannelConfig config)
finishConnectback to summary
private void finishConnect()
fireEventAndCloseback to summary
private void fireEventAndClose(Object evt)
flush0back to summary
protected final void flush0()

Overrides io.netty.channel.AbstractChannel.AbstractUnsafe.flush0.

Annotations
@Override
fulfillConnectPromiseback to summary
private void fulfillConnectPromise(ChannelPromise promise, boolean wasActive)
fulfillConnectPromiseback to summary
private void fulfillConnectPromise(ChannelPromise promise, Throwable cause)
newEpollHandleback to summary
pack-priv EpollRecvByteAllocatorHandle newEpollHandle(RecvByteBufAllocator.ExtendedHandle handle)

Deprecated

as a consequence of RecvByteBufAllocator.ExtendedHandle and EpollRecvByteAllocatorHandle being deprecated. See corresponding docs for further information.

Create a new EpollRecvByteAllocatorHandle instance.

Parameters
handle:RecvByteBufAllocator.ExtendedHandle

The handle to wrap with EPOLL specific logic.

recvBufAllocHandleback to summary
public EpollRecvByteAllocatorHandle recvBufAllocHandle()

Overrides io.netty.channel.AbstractChannel.AbstractUnsafe.recvBufAllocHandle.

Implements io.netty.channel.Channel.Unsafe.recvBufAllocHandle.

Doc from io.netty.channel.Channel.Unsafe.recvBufAllocHandle.

Deprecated

as a consequence of EpollRecvByteAllocatorHandle being deprecated. See corresponding docs for further information.

Return the assigned RecvByteBufAllocator.Handle which will be used to allocate ByteBuf's when receiving data.

Annotations
@Override
shutdownInputback to summary
pack-priv void shutdownInput(boolean rdHup)

Shutdown the input side of the channel.