Interface IoUringBackend.ExtendedCompletionHandler

All Superinterfaces:
CompletionHandler
Enclosing class:
IoUringBackend

public static interface IoUringBackend.ExtendedCompletionHandler extends CompletionHandler
Extended completion handler that receives CQE flags.

Use this interface when working with:

  • Zero-copy send (SEND_ZC) - check for IORING_CQE_F_NOTIF
  • Multi-shot receive - check for IORING_CQE_F_MORE
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    onComplete(long token, int result)
    Called when an asynchronous I/O operation completes.
    void
    onComplete(long token, int result, int flags)
    Called when an operation completes with flags.
  • Method Details

    • onComplete

      void onComplete(long token, int result, int flags)
      Called when an operation completes with flags.
      Parameters:
      token - user data token
      result - operation result (bytes transferred or negative errno)
      flags - CQE flags:
      • IORING_CQE_F_NOTIF (1 << 3) - Zero-copy notification (buffer can be reused)
      • IORING_CQE_F_MORE (1 << 1) - More completions coming (multishot active)
    • onComplete

      default void onComplete(long token, int result)
      Description copied from interface: CompletionHandler
      Called when an asynchronous I/O operation completes.

      Thread Safety: This method is called from the I/O polling thread. Implementations must be thread-safe if the handler is shared across threads.

      Performance: This method is on the hot path. Avoid allocations, blocking calls, or expensive computations.

      Specified by:
      onComplete in interface CompletionHandler
      Parameters:
      token - the user-defined token passed when the operation was initiated; use this to correlate completions with pending operations
      result - the operation result:
      • Positive: bytes transferred
      • Zero: operation completed with no data
      • -1: EOF (peer closed connection)
      • Negative: Linux errno (use -result to get errno value)