Class Http2ConnectionLiveness

java.lang.Object
reactor.netty.http.Http2ConnectionLiveness
All Implemented Interfaces:
HttpConnectionLiveness

public final class Http2ConnectionLiveness extends Object implements HttpConnectionLiveness
Supports connection health checks using HTTP/2 PING frames.

This class implements liveness detection for HTTP/2 connections by sending PING frames when the connection becomes idle (no read/write activity). The peer must respond with a PING ACK within the configured timeout, otherwise the connection is considered unresponsive.

Behavior

  • PING frames are only sent when the connection is idle (no active reads/writes)
  • Each PING frame must receive an ACK within pingAckTimeout
  • If no ACK is received, retry up to pingAckDropThreshold times
  • If all attempts fail, the connection is closed
  • Receiving any HTTP/2 frame (HEADERS, DATA, or PING ACK) cancels the health check

Thread Safety

This class is designed to be used with a single channel. All operations, including scheduled tasks, execute on the channel's event loop thread, eliminating the need for explicit synchronization. A new instance is created per channel.

Configuration Guidelines

  • pingAckTimeout: Should account for expected network latency and load. Values that are too short may cause false positives due to temporary delays.
  • pingAckDropThreshold: Balance between quick failure detection and tolerance for transient issues. Higher values increase detection time but reduce false positives.
Since:
1.2.12
Author:
raccoonback, Violeta Georgieva
  • Constructor Details

    • Http2ConnectionLiveness

      public Http2ConnectionLiveness(Http2FrameCodec http2FrameCodec, int pingAckDropThreshold, long pingAckTimeoutNanos)
      Constructs a new Http2ConnectionLiveness instance.
      Parameters:
      http2FrameCodec - the HTTP/2 frame codec
      pingAckDropThreshold - the maximum number of PING frame transmission attempts before closing the connection
      pingAckTimeoutNanos - the timeout in nanoseconds for receiving a PING ACK response
  • Method Details