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.
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.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceObservation of one physical connection.static enumConnection termination outcome.static enumStream directionality.static enumConnection handshake.static interfaceObservation of one security handshake.static enumHandshake completion outcome.static enumStream initiator relative to the observing endpoint.static enumEndpoint role.static interfaceObservation of one application request and response exchange.static enumStream termination outcome. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringKnown protocol identifier for HTTP/1.1, aligned with the HTTP transport metrics tag value.static final StringKnown protocol identifier for HTTP/2, aligned with the HTTP transport metrics tag value.static final StringKnown protocol identifier for HTTP/3, aligned with the HTTP transport metrics tag value.static final StringKnown transport identifier for QUIC.static final StringKnown transport identifier for TCP.static final StringKnown transport identifier for Unix domain sockets. -
Method Summary
Modifier and TypeMethodDescriptionstatic HttpTransportObservercompose(List<? extends HttpTransportObserver> observers) Combines observers into one failure-isolating observer.connectionOpened(HttpTransportObserver.Role role, String transport, HttpTransportObserver.Handshake handshake) Observes an opened physical connection.static HttpTransportObservernoop()Returns an observer which ignores all lifecycle events.
-
Field Details
-
TRANSPORT_TCP
-
TRANSPORT_UNIX
-
TRANSPORT_QUIC
-
PROTOCOL_HTTP_1_1
Known protocol identifier for HTTP/1.1, aligned with the HTTP transport metrics tag value.- See Also:
-
PROTOCOL_HTTP_2
Known protocol identifier for HTTP/2, aligned with the HTTP transport metrics tag value.- See Also:
-
PROTOCOL_HTTP_3
Known protocol identifier for HTTP/3, aligned with the HTTP transport metrics tag value.- See Also:
-
-
Method Details
-
noop
Returns an observer which ignores all lifecycle events.- Returns:
- no-op observer
-
compose
Combines observers into one failure-isolating observer.Duplicate observer instances are included only once. A
RuntimeExceptionfrom one observer is logged and does not prevent the remaining observers from receiving the event. Any otherThrowableis rethrown; a connection transition failure is rethrown after transitions already queued for that connection complete.- Parameters:
observers- observers to combine- Returns:
- combined observer
-
connectionOpened
HttpTransportObserver.ConnectionObservation connectionOpened(HttpTransportObserver.Role role, String transport, HttpTransportObserver.Handshake handshake) 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 roletransport- non-blank physical transport identifierhandshake- connection handshake type- Returns:
- connection observation
-