Interface HttpTransportObserver

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 interface HttpTransportObserver
Protocol-neutral observation of HTTP transport lifecycle.

Callbacks must not block. Lifecycle events for one connection are published sequentially as specified by HttpTransportObserver.ConnectionObservation. Callbacks for different connections may be invoked concurrently, so implementations must be thread safe. Observation must not affect protocol or transport behavior. Observer callbacks are passive and must not directly or indirectly invoke lifecycle methods on a HttpTransportObserver.ConnectionObservation, HttpTransportObserver.HandshakeObservation, or HttpTransportObserver.StreamObservation; callback reentry is not supported.

  • Field Details

    • TRANSPORT_TCP

      static final String TRANSPORT_TCP
      Known transport identifier for TCP.
      See Also:
    • TRANSPORT_UNIX

      static final String TRANSPORT_UNIX
      Known transport identifier for Unix domain sockets.
      See Also:
    • TRANSPORT_QUIC

      static final String TRANSPORT_QUIC
      Known transport identifier for QUIC.
      See Also:
    • PROTOCOL_HTTP_1_1

      static final String PROTOCOL_HTTP_1_1
      Known protocol identifier for HTTP/1.1, aligned with the HTTP transport metrics tag value.
      See Also:
    • PROTOCOL_HTTP_2

      static final String PROTOCOL_HTTP_2
      Known protocol identifier for HTTP/2, aligned with the HTTP transport metrics tag value.
      See Also:
    • PROTOCOL_HTTP_3

      static final String PROTOCOL_HTTP_3
      Known protocol identifier for HTTP/3, aligned with the HTTP transport metrics tag value.
      See Also:
  • Method Details

    • noop

      static HttpTransportObserver noop()
      Returns an observer which ignores all lifecycle events.
      Returns:
      no-op observer
    • compose

      static HttpTransportObserver compose(List<? extends HttpTransportObserver> observers)
      Combines observers into one failure-isolating observer.

      Duplicate observer instances are included only once. A RuntimeException from one observer is logged and does not prevent the remaining observers from receiving the event. Any other Throwable is rethrown; a connection transition failure is rethrown after transitions already queued for that connection complete.

      Parameters:
      observers - observers to combine
      Returns:
      combined observer
    • connectionOpened

      Observes an opened physical connection.

      The caller owns the returned observation and closes it when the connection terminates. The returned observation must not be null.

      Parameters:
      role - endpoint role
      transport - non-blank physical transport identifier
      handshake - connection handshake type
      Returns:
      connection observation