Class WriteOperation

java.lang.Object
io.netty.channel.uring.WriteOperation

final class WriteOperation extends Object
A slot tracking the references a submitted SQE handed to the kernel. Recording does not retain: the outbound buffer owns them until the write completes or retainReferences() takes over. Slots are reused and the backing array is kept across reuses, so a slot allocates only on its first use and when a write hands it more references than any earlier use did. abandon() is how a slot is ended outside of a completion CQE -- see its javadoc for the three situations that call it.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private boolean
     
    private int
     
    private static final ReferenceCounted[]
     
    private byte
     
     
    private int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) void
    Ends this slot without it ever seeing a completion CQE.
    (package private) void
    complete(int cqeFlags)
    Releases the slot on the terminal CQE: a notification, or any completion without IORING_CQE_F_MORE.
    private void
     
    (package private) boolean
    Whether this slot is occupied.
    (package private) byte
     
    (package private) void
    record(byte opCode, ReferenceCounted reference)
     
    (package private) void
    record(byte opCode, ReferenceCounted[] references, int count)
    Copies references so the caller may reuse the array: a zero-copy slot stays alive from its primary CQE until the follow-up IORING_CQE_F_NOTIF, during which a reused collector array would be overwritten.
    (package private) void
    NOOP once every reference is retained or while the slot is inactive.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • EMPTY_REFERENCES

      private static final ReferenceCounted[] EMPTY_REFERENCES
    • opCode

      private byte opCode
    • references

      private ReferenceCounted[] references
    • count

      private int count
    • active

      private boolean active
    • retainedCount

      private int retainedCount
  • Constructor Details

    • WriteOperation

      WriteOperation()
  • Method Details

    • record

      void record(byte opCode, ReferenceCounted reference)
    • record

      void record(byte opCode, ReferenceCounted[] references, int count)
      Copies references so the caller may reuse the array: a zero-copy slot stays alive from its primary CQE until the follow-up IORING_CQE_F_NOTIF, during which a reused collector array would be overwritten.
    • retainReferences

      void retainReferences()
      NOOP once every reference is retained or while the slot is inactive. retainedCount only advances past an index once its retain() call actually returns, so a retain() that throws partway leaves finish() to release exactly the references that were retained, instead of over-releasing the ones that never were.
    • isActive

      boolean isActive()
      Whether this slot is occupied. A submitted SQE that ended up with zero references still occupies it.
    • opCode

      byte opCode()
    • complete

      void complete(int cqeFlags)
      Releases the slot on the terminal CQE: a notification, or any completion without IORING_CQE_F_MORE.
    • abandon

      void abandon()
      Ends this slot without it ever seeing a completion CQE. Called in three situations: (1) submission itself failed, so the kernel never saw the SQE and no CQE will ever arrive for it; (2) deregistration discards a slot whose completion this channel can no longer observe, and retainReferences() never ran on it, making this call a plain discard; (3) deregistration discards a slot that retainReferences() did retain before a shutdown, in which case this call is what actually releases those references.
    • finish

      private void finish()