Package reactor.netty.http.client
Interface Http2AllocationStrategy.Builder
- Enclosing class:
- Http2AllocationStrategy
public static interface Http2AllocationStrategy.Builder
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Build a newHttp2AllocationStrategy.maxConcurrentStreams(long maxConcurrentStreams) Configures the maximum number of the concurrent streams that can be opened to the remote peer.maxConnections(int maxConnections) Configures the maximum number of live connections to keep in the pool.minConnections(int minConnections) Configures the minimum number of live connections to keep in the pool (can be the best effort).default Http2AllocationStrategy.BuilderstreamBatchSize(int streamBatchSize) Configures the maximum number of streams that can be opened at once when a suitable connection is found in the pool.default Http2AllocationStrategy.BuilderstrictConnectionReuse(boolean strictConnectionReuse) Configures whether the HTTP/2 pool should avoid opening additional connections as long as existing connections have not reached their max concurrent streams limit.
-
Method Details
-
build
Http2AllocationStrategy build()Build a newHttp2AllocationStrategy.- Returns:
- a new
Http2AllocationStrategy
-
maxConcurrentStreams
Configures the maximum number of the concurrent streams that can be opened to the remote peer. When evaluating how many streams can be opened to the remote peer, the minimum of this configuration and the remote peer configuration is taken (unless -1 is used). Default to-1- use always the remote peer configuration.- Parameters:
maxConcurrentStreams- the maximum number of the concurrent streams that can be opened to the remote peer- Returns:
this
-
maxConnections
Configures the maximum number of live connections to keep in the pool. Default toInteger.MAX_VALUE- no upper limit.- Parameters:
maxConnections- the maximum number of live connections to keep in the pool- Returns:
this
-
minConnections
Configures the minimum number of live connections to keep in the pool (can be the best effort). When configured with a value greater than zero, the pool will also enablestrict connection reuse. Default to0.- Parameters:
minConnections- the minimum number of live connections to keep in the pool- Returns:
this- See Also:
-
strictConnectionReuse
Configures whether the HTTP/2 pool should avoid opening additional connections as long as existing connections have not reached their max concurrent streams limit. When enabled, the pool may operate with fewer connections (even a single one) and will only allocate a new connection when all existing connections have reached their max concurrent streams.This behavior is automatically enabled when
minConnections(int)is configured with a value greater than zero. Use this option to enable the same behavior without setting a minimum connections constraint.Default to
false.- Parameters:
strictConnectionReuse- whether strict connection reuse should be enabled- Returns:
this- Since:
- 1.3.3
-
streamBatchSize
Configures the maximum number of streams that can be opened at once when a suitable connection is found in the pool. When the pool finds a connection that can be used for opening a stream, instead of opening only one stream and then re-evaluating the available connections, the pool will attempt to open up tostreamBatchSizestreams on that connection (limited by the connection's available capacity, i.e. max concurrent streams minus current active streams).This setting takes effect when strict connection reuse is active, either by enabling
strictConnectionReuse(true)or by settingminConnectionsto a value greater than zero.Default to
1- open one stream at a time.- Parameters:
streamBatchSize- the maximum number of streams to open at once per connection- Returns:
this- Since:
- 1.3.4
- See Also:
-