Class AbstractIoUringChannel

All Implemented Interfaces:
Channel, ChannelOutboundInvoker, UnixChannel, AttributeMap, Comparable<Channel>
Direct Known Subclasses:
AbstractIoUringServerChannel, AbstractIoUringStreamChannel, IoUringDatagramChannel

abstract class AbstractIoUringChannel extends AbstractChannel implements UnixChannel
  • Field Details

    • logger

      private static final InternalLogger logger
    • socket

      final LinuxSocket socket
    • writeTracker

      final WriteOperationTracker writeTracker
    • active

      protected volatile boolean active
    • POLL_IN_SCHEDULED

      private static final int POLL_IN_SCHEDULED
      See Also:
    • POLL_OUT_SCHEDULED

      private static final int POLL_OUT_SCHEDULED
      See Also:
    • POLL_RDHUP_SCHEDULED

      private static final int POLL_RDHUP_SCHEDULED
      See Also:
    • WRITE_SCHEDULED

      private static final int WRITE_SCHEDULED
      See Also:
    • READ_SCHEDULED

      private static final int READ_SCHEDULED
      See Also:
    • CONNECT_SCHEDULED

      private static final int CONNECT_SCHEDULED
      See Also:
    • opsId

      private short opsId
    • pollInId

      private long pollInId
    • pollOutId

      private long pollOutId
    • pollRdhupId

      private long pollRdhupId
    • connectId

      private long connectId
    • ioState

      private byte ioState
    • numOutstandingWrites

      private short numOutstandingWrites
    • numOutstandingReads

      private short numOutstandingReads
    • readPending

      private boolean readPending
    • inReadComplete

      private boolean inReadComplete
    • socketHasMoreData

      private boolean socketHasMoreData
    • delayedClose

    • inputClosedSeenErrorOnRead

      private boolean inputClosedSeenErrorOnRead
    • connectPromise

      private ChannelPromise connectPromise
      The future of the current connection attempt. If not null, subsequent connection attempts will fail.
    • connectTimeoutFuture

      private ScheduledFuture<?> connectTimeoutFuture
    • requestedRemoteAddress

      private SocketAddress requestedRemoteAddress
    • cleanable

      private CleanableDirectBuffer cleanable
    • remoteAddressMemory

      private ByteBuffer remoteAddressMemory
    • msgHdrMemoryArray

      private MsgHdrMemoryArray msgHdrMemoryArray
    • registration

      private IoRegistration registration
    • local

      private volatile SocketAddress local
    • remote

      private volatile SocketAddress remote
  • Constructor Details

  • Method Details

    • autoReadCleared

      final void autoReadCleared()
    • clearRead

      private void clearRead()
    • nextOpsId

      protected final short nextOpsId()
      Returns the next id that should be used when submitting IoUringIoOps.
      Returns:
      opsId
    • isOpen

      public final boolean isOpen()
      Description copied from interface: Channel
      Returns true if the Channel is open and may get active later
      Specified by:
      isOpen in interface Channel
    • isActive

      public boolean isActive()
      Description copied from interface: Channel
      Return true if the Channel is active and so connected.
      Specified by:
      isActive in interface Channel
    • fd

      public final FileDescriptor fd()
      Description copied from interface: UnixChannel
      Returns the FileDescriptor that is used by this Channel.
      Specified by:
      fd in interface UnixChannel
    • ioUringUnsafe

    • isCompatible

      protected boolean isCompatible(EventLoop loop)
      Description copied from class: AbstractChannel
      Return true if the given EventLoop is compatible with this instance.
      Specified by:
      isCompatible in class AbstractChannel
    • newDirectBuffer

      protected final ByteBuf newDirectBuffer(ByteBuf buf)
    • allowMultiShotPollIn

      protected boolean allowMultiShotPollIn()
    • newDirectBuffer

      protected final ByteBuf newDirectBuffer(Object holder, ByteBuf buf)
    • newDirectBuffer0

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

      protected abstract void cancelOutstandingReads(IoRegistration registration, int numOutstandingReads)
      Cancel all outstanding reads
      Parameters:
      registration - the IoRegistration.
      numOutstandingReads - the number of outstanding reads, or -1 if multi-shot was used.
    • cancelOutstandingWrites

      protected abstract void cancelOutstandingWrites(IoRegistration registration, int numOutstandingWrites)
      Cancel all outstanding writes
      Parameters:
      registration - the IoRegistration.
      numOutstandingWrites - the number of outstanding writes.
    • doDisconnect

      protected void doDisconnect() throws Exception
      Description copied from class: AbstractChannel
      Disconnect this Channel from its remote peer
      Specified by:
      doDisconnect in class AbstractChannel
      Throws:
      Exception
    • freeRemoteAddressMemory

      private void freeRemoteAddressMemory()
    • freeMsgHdrArray

      private void freeMsgHdrArray()
    • doClose

      protected void doClose() throws Exception
      Description copied from class: AbstractChannel
      Close the Channel
      Specified by:
      doClose in class AbstractChannel
      Throws:
      Exception
    • doShutdownOutput

      protected final void doShutdownOutput() throws Exception
      Retains every in-flight write's references before handing off to doShutdownOutput0(), so a write completion that races the shutdown still finds a live reference to release instead of one the outbound buffer already dropped.
      Overrides:
      doShutdownOutput in class AbstractChannel
      Throws:
      Exception
    • doShutdownOutput0

      protected void doShutdownOutput0() throws Exception
      Performs the actual output shutdown. Overridden by subclasses that support it.
      Throws:
      Exception
    • doBeginRead

      protected final void doBeginRead()
      Description copied from class: AbstractChannel
      Schedule a read operation.
      Specified by:
      doBeginRead in class AbstractChannel
    • doBeginReadNow

      private void doBeginReadNow()
    • doWrite

      protected void doWrite(ChannelOutboundBuffer in)
      Description copied from class: AbstractChannel
      Flush the content of the given buffer to the remote peer.
      Specified by:
      doWrite in class AbstractChannel
    • scheduleWriteIfNeeded

      protected void scheduleWriteIfNeeded(ChannelOutboundBuffer in, boolean submitAndRunNow)
    • submitAndRunNow

      protected void submitAndRunNow()
    • scheduleWrite

      private int scheduleWrite(ChannelOutboundBuffer in)
    • registration

      protected final IoRegistration registration()
    • schedulePollOut

      private void schedulePollOut()
    • schedulePollRdHup

      final void schedulePollRdHup()
    • isStreamSocket

      protected abstract boolean isStreamSocket()
    • schedulePollAdd

      private long schedulePollAdd(int ioMask, int mask, boolean multishot)
    • resetCachedAddresses

      final void resetCachedAddresses()
    • narrowUserData

      private static short narrowUserData(long userData)
    • submitConnect

      private void submitConnect(InetSocketAddress inetSocketAddress)
    • submitConnect

      private void submitConnect(DomainSocketAddress unixDomainSocketAddress)
    • filterOutboundMessage

      protected Object filterOutboundMessage(Object msg)
      Description copied from class: AbstractChannel
      Invoked when a new message is added to a ChannelOutboundBuffer of this AbstractChannel, so that the Channel implementation converts the message to another. (e.g. heap buffer -> direct buffer)
      Overrides:
      filterOutboundMessage in class AbstractChannel
    • doRegister

      protected void doRegister(ChannelPromise promise)
      Description copied from class: AbstractChannel
      Is called after the Channel is registered with its EventLoop as part of the register process. Subclasses may override this method
      Overrides:
      doRegister in class AbstractChannel
      Parameters:
      promise - ChannelPromise that must be notified once done to continue the registration.
    • doDeregister

      protected final void doDeregister()
      Description copied from class: AbstractChannel
      Deregister the Channel from its EventLoop. Sub-classes may override this method
      Overrides:
      doDeregister in class AbstractChannel
    • doBind

      protected void doBind(SocketAddress local) throws Exception
      Description copied from class: AbstractChannel
      Bind the Channel to the SocketAddress
      Specified by:
      doBind in class AbstractChannel
      Throws:
      Exception
    • checkResolvable

      protected static void checkResolvable(InetSocketAddress addr)
    • localAddress0

      protected final SocketAddress localAddress0()
      Description copied from class: AbstractChannel
      Returns the SocketAddress which is bound locally.
      Specified by:
      localAddress0 in class AbstractChannel
    • remoteAddress0

      protected final SocketAddress remoteAddress0()
      Description copied from class: AbstractChannel
      Return the SocketAddress which the Channel is connected to.
      Specified by:
      remoteAddress0 in class AbstractChannel
    • isAllowHalfClosure

      private static boolean isAllowHalfClosure(ChannelConfig config)
    • cancelConnectTimeoutFuture

      private void cancelConnectTimeoutFuture()
    • computeRemote

      private void computeRemote()
    • shouldBreakIoUringInReady

      private boolean shouldBreakIoUringInReady(ChannelConfig config)
    • socketIsEmpty

      protected abstract boolean socketIsEmpty(int flags)
      Return if the socket is guaranteed to be empty when the submitted io was executed and the completion event be created.
      Parameters:
      flags - the flags that were part of the completion
      Returns:
      true if empty.
    • isPollInFirst

      abstract boolean isPollInFirst()