Interface Http2SettingsSpec.Builder
- Enclosing class:
- Http2SettingsSpec
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Build a newHttp2SettingsSpec.connectProtocolEnabled(boolean connectProtocolEnabled) Sets theSETTINGS_ENABLE_CONNECT_PROTOCOLvalue.headerTableSize(long headerTableSize) Sets theSETTINGS_HEADER_TABLE_SIZEvalue.initialWindowSize(int initialWindowSize) Sets theSETTINGS_INITIAL_WINDOW_SIZEvalue.maxConcurrentStreams(long maxConcurrentStreams) Sets theSETTINGS_MAX_CONCURRENT_STREAMSvalue.maxDecodedRstFramesPerWindow(int maxDecodedRstFramesPerWindow, int maxDecodedRstFramesSecondsPerWindow) Sets the maximum number RST frames that are allowed per window before the connection is closed.maxEncodedRstFramesPerWindow(int maxEncodedRstFramesPerWindow, int maxEncodedRstFramesSecondsPerWindow) Sets the maximum number RST frames that are allowed per window before the connection is closed.maxFrameSize(int maxFrameSize) Sets theSETTINGS_MAX_FRAME_SIZEvalue.maxHeaderListSize(long maxHeaderListSize) Sets theSETTINGS_MAX_HEADER_LIST_SIZEvalue.maxStreams(long maxStreams) The connection is marked for closing once the number of all-time streams reachesmaxStreams.default Http2SettingsSpec.BuilderpingAckDropThreshold(int pingAckDropThreshold) Sets the maximum number of PING frame transmission attempts before closing the connection.default Http2SettingsSpec.BuilderpingAckTimeout(Duration pingAckTimeout) Sets the timeout for receiving an ACK response to HTTP/2 PING frames.
-
Method Details
-
build
Http2SettingsSpec build()Build a newHttp2SettingsSpec.- Returns:
- a new
Http2SettingsSpec
-
connectProtocolEnabled
Sets theSETTINGS_ENABLE_CONNECT_PROTOCOLvalue.- Parameters:
connectProtocolEnabled- theSETTINGS_ENABLE_CONNECT_PROTOCOLvalue- Returns:
this- Since:
- 1.2.5
-
headerTableSize
Sets theSETTINGS_HEADER_TABLE_SIZEvalue.- Parameters:
headerTableSize- theSETTINGS_HEADER_TABLE_SIZEvalue- Returns:
this
-
initialWindowSize
Sets theSETTINGS_INITIAL_WINDOW_SIZEvalue.- Parameters:
initialWindowSize- theSETTINGS_INITIAL_WINDOW_SIZEvalue- Returns:
this
-
maxConcurrentStreams
Sets theSETTINGS_MAX_CONCURRENT_STREAMSvalue.- Parameters:
maxConcurrentStreams- theSETTINGS_MAX_CONCURRENT_STREAMSvalue- Returns:
this
-
maxDecodedRstFramesPerWindow
Http2SettingsSpec.Builder maxDecodedRstFramesPerWindow(int maxDecodedRstFramesPerWindow, int maxDecodedRstFramesSecondsPerWindow) Sets the maximum number RST frames that are allowed per window before the connection is closed. This allows to protect against the remote peer flooding us with such frames and so use up a lot of CPU.0for any of the parameters means no protection should be applied. For server, the default {code maxDecodedRstFramesPerWindow} is200and for the client it is0. The default {code maxDecodedRstFramesSecondsPerWindow} is30.- Parameters:
maxDecodedRstFramesPerWindow- the maximum number RST frames that are allowed per windowmaxDecodedRstFramesSecondsPerWindow- the maximum seconds per window- Returns:
this- Since:
- 1.2.11
-
maxEncodedRstFramesPerWindow
Http2SettingsSpec.Builder maxEncodedRstFramesPerWindow(int maxEncodedRstFramesPerWindow, int maxEncodedRstFramesSecondsPerWindow) Sets the maximum number RST frames that are allowed per window before the connection is closed. This allows to protect against the remote peer that will trigger us to generate a flood of RST frames and so use up a lot of CPU.0for any of the parameters means no protection should be applied. For server, the default {code maxEncodedRstFramesPerWindow} is200and for the client it is0. The default {code maxEncodedRstFramesSecondsPerWindow} is30.- Parameters:
maxEncodedRstFramesPerWindow- the maximum number RST frames that are allowed per windowmaxEncodedRstFramesSecondsPerWindow- the maximum seconds per window- Returns:
this- Since:
- 1.2.11
-
maxFrameSize
Sets theSETTINGS_MAX_FRAME_SIZEvalue.- Parameters:
maxFrameSize- theSETTINGS_MAX_FRAME_SIZEvalue- Returns:
this
-
maxHeaderListSize
Sets theSETTINGS_MAX_HEADER_LIST_SIZEvalue.- Parameters:
maxHeaderListSize- theSETTINGS_MAX_HEADER_LIST_SIZEvalue- Returns:
this
-
maxStreams
The connection is marked for closing once the number of all-time streams reachesmaxStreams.- Returns:
this- Since:
- 1.0.33
-
pingAckDropThreshold
Sets the maximum number of PING frame transmission attempts before closing the connection.This method configures how many PING frames will be sent without receiving an ACK before considering the connection as unresponsive and closing it. Each PING waits for
pingAckTimeout(Duration)before either receiving an ACK (which resets the health check) or timing out and sending the next PING.Example with
pingAckDropThreshold=1:- Connection becomes idle
- First PING frame is sent
- Wait up to
pingAckTimeoutfor ACK - If no ACK received, connection is closed (1 attempt limit reached)
Example with
pingAckDropThreshold=2:- Connection becomes idle
- First PING frame is sent
- Wait up to
pingAckTimeoutfor ACK - If no ACK received, second PING frame is sent
- Wait up to
pingAckTimeoutfor ACK - If no ACK received, connection is closed (2 attempt limit reached)
A lower threshold detects connection failures more quickly but may lead to premature disconnections if network latency is high. A higher threshold tolerates more packet loss or delays but increases the time to detect truly dead connections.
The default
pingAckDropThresholdis1, meaning only one PING frame will be sent. If no ACK is received withinpingAckTimeout, the connection closes immediately.- Parameters:
pingAckDropThreshold- the maximum number of PING transmission attempts without receiving ACK. Must be a positive integer (minimum 1). Default is 1.- Returns:
this- Since:
- 1.2.12
-
pingAckTimeout
Sets the timeout for receiving an ACK response to HTTP/2 PING frames.This method configures how long to wait for a PING ACK response before either retrying or closing the connection (based on
pingAckDropThreshold(int)). This timeout is used in conjunction with the idle timeout to detect unresponsive connections.When a connection becomes idle (no reads/writes for the configured idle timeout duration), a PING frame is sent to check if the peer is still responsive. If no ACK is received within the
pingAckTimeoutduration, another PING attempt may be made (depending onpingAckDropThreshold). If all attempts fail, the connection is closed.Important: This setting only takes effect when used together with:
- For client:
ConnectionProviderwithmaxIdleTimeconfigured - For server:
HttpServerwithidleTimeoutconfigured
The timeout should be chosen based on your network conditions and requirements:
- Too short: May cause false positives and premature connection closures due to temporary delays
- Too long: Delays detection of truly unresponsive connections
- Parameters:
pingAckTimeout- the timeout duration to wait for a PING ACK response. Must be a positive value.- Returns:
this- Since:
- 1.2.12
- For client:
-