Interface Session.RequestQueuedCallback

All Superinterfaces:
FunctionPointer
Enclosing class:
Session
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface Session.RequestQueuedCallback extends FunctionPointer

Functional interface declaration of the RequestQueuedCallback callback.

See Also:
  • Method Details

    • run

      void run(@Nullable Message msg)

      Emitted when a request is queued on session.

      When sending a request, first Session::request-queued is emitted, indicating that the session has become aware of the request.

      After a connection is available to send the request various Message signals are emitted as the message is processed. If the message is requeued, it will emit Message::restarted, which will then be followed by other Message signals when the message is re-sent.

      Eventually, the message will emit Message::finished. Normally, this signals the completion of message processing. However, it is possible that the application will requeue the message from the "finished" handler. In that case the process will loop back.

      Eventually, a message will reach "finished" and not be requeued. At that point, the session will emit Session::request-unqueued to indicate that it is done with the message.

      To sum up: Session::request-queued and Session::request-unqueued are guaranteed to be emitted exactly once, but Message::finished (and all of the other Message signals) may be invoked multiple times for a given message.

    • upcall

      default void upcall(MemorySegment sourceSession, MemorySegment msg)
      The upcall method is called from native code. The parameters are marshaled and run(Message) is executed.
    • toCallback

      default MemorySegment toCallback(Arena arena)
      Creates a native function pointer to the upcall(MemorySegment, MemorySegment) method.
      Specified by:
      toCallback in interface FunctionPointer
      Parameters:
      arena - the arena in which the function pointer is allocated
      Returns:
      the native function pointer