Class WriteOperation


  • final class WriteOperation
    extends java.lang.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.
    • Constructor Summary

      Constructors 
      Constructor Description
      WriteOperation()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) void abandon()
      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 finish()  
      (package private) boolean isActive()
      Whether this slot is occupied.
      (package private) byte opCode()  
      (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 retainReferences()
      NOOP once every reference is retained or while the slot is inactive.
      • Methods inherited from class java.lang.Object

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

      • opCode

        private byte opCode
      • count

        private int count
      • active

        private boolean active
      • retainedCount

        private int retainedCount
    • Constructor Detail

      • WriteOperation

        WriteOperation()
    • Method Detail

      • 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()