Package software.amazon.awssdk.crt.http
Class Http2StreamManagerOptions
- java.lang.Object
-
- software.amazon.awssdk.crt.http.Http2StreamManagerOptions
-
public class Http2StreamManagerOptions extends Object
Contains all the configuration options for a Http2StreamManager instance
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_CONNECTION_PING_TIMEOUT_MS
static int
DEFAULT_MAX
static int
DEFAULT_MAX_CONNECTIONS
static int
DEFAULT_MAX_WINDOW_SIZE
-
Constructor Summary
Constructors Constructor Description Http2StreamManagerOptions()
Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpClientConnectionManagerOptions
getConnectionManagerOptions()
int
getConnectionPingPeriodMs()
int
getConnectionPingTimeoutMs()
int
getIdealConcurrentStreamsPerConnection()
List<Http2ConnectionSetting>
getInitialSettingsList()
int
getMaxConcurrentStreamsPerConnection()
boolean
hasPriorKnowledge()
boolean
isConnectionManualWindowManagement()
boolean
shouldCloseConnectionOnServerError()
void
validateOptions()
Validate the stream manager options are valid to use.Http2StreamManagerOptions
withCloseConnectionOnServerError(boolean closeConnectionOnServerError)
Set to true to inform stream manager to close connection when response with 500/502/503/504 received.Http2StreamManagerOptions
withConnectionManagerOptions(HttpClientConnectionManagerOptions connectionManagerOptions)
Required.Http2StreamManagerOptions
withConnectionManualWindowManagement(boolean connectionManualWindowManagement)
Set to true to manually manage the flow-control window of whole HTTP/2 connection.Http2StreamManagerOptions
withConnectionPing(int periodMs, int timeoutMs)
Settings to control the period ping to be sent for connections held by stream manager.Http2StreamManagerOptions
withIdealConcurrentStreamsPerConnection(int idealConcurrentStreamsPerConnection)
For HTTP/2 stream manager only.Http2StreamManagerOptions
withInitialSettingsList(List<Http2ConnectionSetting> initialSettingsList)
For HTTP/2 stream manager only.Http2StreamManagerOptions
withMaxConcurrentStreamsPerConnection(int maxConcurrentStreamsPerConnection)
Default is no limit, which will use the limit from the server.Http2StreamManagerOptions
withPriorKnowledge(boolean priorKnowledge)
Set to true to use prior knowledge to setup connection.
-
-
-
Field Detail
-
DEFAULT_MAX_WINDOW_SIZE
public static final int DEFAULT_MAX_WINDOW_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_MAX
public static final int DEFAULT_MAX
- See Also:
- Constant Field Values
-
DEFAULT_MAX_CONNECTIONS
public static final int DEFAULT_MAX_CONNECTIONS
- See Also:
- Constant Field Values
-
DEFAULT_CONNECTION_PING_TIMEOUT_MS
public static final int DEFAULT_CONNECTION_PING_TIMEOUT_MS
- See Also:
- Constant Field Values
-
-
Method Detail
-
withInitialSettingsList
public Http2StreamManagerOptions withInitialSettingsList(List<Http2ConnectionSetting> initialSettingsList)
For HTTP/2 stream manager only. The initial settings for the HTTP/2 connections made by stream manger. `Http2ConnectionSettingListBuilder` can help to build the settings list. To control the initial stream-level flow-control window, set the INITIAL_WINDOW_SIZE setting in the initial settings.- Parameters:
initialSettingsList
- The List of initial settings- Returns:
- this
-
getInitialSettingsList
public List<Http2ConnectionSetting> getInitialSettingsList()
- Returns:
- The List of initial settings
-
withIdealConcurrentStreamsPerConnection
public Http2StreamManagerOptions withIdealConcurrentStreamsPerConnection(int idealConcurrentStreamsPerConnection)
For HTTP/2 stream manager only. The ideal number of concurrent streams for a connection. Stream manager will try to create a new connection if one connection reaches this number. But, if the max connections reaches, manager will reuse connections to create the acquired steams as much as possible.- Parameters:
idealConcurrentStreamsPerConnection
- The ideal number of concurrent streams for a connection- Returns:
- this
-
getIdealConcurrentStreamsPerConnection
public int getIdealConcurrentStreamsPerConnection()
- Returns:
- The ideal number of concurrent streams for a connection used for manager
-
withMaxConcurrentStreamsPerConnection
public Http2StreamManagerOptions withMaxConcurrentStreamsPerConnection(int maxConcurrentStreamsPerConnection)
Default is no limit, which will use the limit from the server. 0 will be considered as using the default value. The real number of concurrent streams per connection will be controlled by the minimal value of the setting from other end and the value here.- Parameters:
maxConcurrentStreamsPerConnection
- The max number of concurrent streams for a connection- Returns:
- this
-
getMaxConcurrentStreamsPerConnection
public int getMaxConcurrentStreamsPerConnection()
- Returns:
- The max number of concurrent streams for a connection set for manager. It could be different than the real limits, which is the minimal set for manager and the settings from the other side.
-
isConnectionManualWindowManagement
public boolean isConnectionManualWindowManagement()
- Returns:
- The connection level manual flow control enabled or not.
-
withConnectionManualWindowManagement
public Http2StreamManagerOptions withConnectionManualWindowManagement(boolean connectionManualWindowManagement)
Set to true to manually manage the flow-control window of whole HTTP/2 connection. The stream level flow-control window is controlled by the manualWindowManagement in connectionManagerOptions.- Parameters:
connectionManualWindowManagement
- Enable connection level manual flow control or not.- Returns:
- this
-
getConnectionManagerOptions
public HttpClientConnectionManagerOptions getConnectionManagerOptions()
- Returns:
- The connection manager options for the underlying connection manager.
-
withConnectionManagerOptions
public Http2StreamManagerOptions withConnectionManagerOptions(HttpClientConnectionManagerOptions connectionManagerOptions)
Required. The configuration options for the connection manager under the hood. It controls the connection specific thing for the stream manager. See `HttpClientConnectionManagerOptions` for details. Note: 1. the windowSize of connection manager will be ignored, as the initial flow-control window size for HTTP/2 stream is controlled by the initial settings. 2. The expectedHttpVersion will also be ignored.- Parameters:
connectionManagerOptions
- The connection manager options for the underlying connection manager- Returns:
- this
-
hasPriorKnowledge
public boolean hasPriorKnowledge()
- Returns:
- Prior knowledge is used or not
-
withPriorKnowledge
public Http2StreamManagerOptions withPriorKnowledge(boolean priorKnowledge)
Set to true to use prior knowledge to setup connection. If any TLS was set, exception will be raised if prior knowledge is set during validation. If NO TLS was set, exception will be raised if prior knowledge is NOT set during validation.- Parameters:
priorKnowledge
- Prior knowledge used or not.- Returns:
- this
-
shouldCloseConnectionOnServerError
public boolean shouldCloseConnectionOnServerError()
- Returns:
- Connection closed or not when server error happened (500/502/503/504 response status code received).
-
withCloseConnectionOnServerError
public Http2StreamManagerOptions withCloseConnectionOnServerError(boolean closeConnectionOnServerError)
Set to true to inform stream manager to close connection when response with 500/502/503/504 received. Stream manager will stop using the connection with server error will start a new connection for other streams.- Parameters:
closeConnectionOnServerError
- Connection closed or not when server error happened.- Returns:
- this
-
withConnectionPing
public Http2StreamManagerOptions withConnectionPing(int periodMs, int timeoutMs)
Settings to control the period ping to be sent for connections held by stream manager.- Parameters:
periodMs
- The period for all the connections held by stream manager to send a PING in milliseconds. If you specify 0, manager will NOT send any PING.timeoutMs
- Network connection will be closed if a ping response is not received within this amount of time (milliseconds). If you specify 0, a default value will be used. If this is larger than periodMs, it will be capped to be equal.- Returns:
- this
-
getConnectionPingPeriodMs
public int getConnectionPingPeriodMs()
- Returns:
- The period for all the connections held by stream manager to send a PING in milliseconds.
-
getConnectionPingTimeoutMs
public int getConnectionPingTimeoutMs()
- Returns:
- The time for closing connection if ping not received within this amount of time in milliseconds
-
validateOptions
public void validateOptions()
Validate the stream manager options are valid to use. Throw exceptions if not.
-
-