scoop:scoop.http.client:0.1.0
src/pool/options.scoop
Selected production source · src/pool/options.scoop
1
package scoop.http.client3
import scoop.time.Duration5
/**6
* Positive connection/HTTP2 stream capacities plus idle and optional maximum connection lifetimes.7
*/8
public class HttpConnectionPoolOptions internal constructor(9
/**10
* Maximum connections pooled or being established for one origin.11
*/12
public val maxConnectionsPerOrigin: Long = 8L,13
/**14
* Maximum connections across the client.15
*/16
public val maxConnections: Long = 64L,17
/**18
* Local concurrent-stream cap per HTTP/2 connection, also constrained by peer settings.19
*/20
public val maxStreamsPerHttp2: Long = 100L,21
/**22
* How long an unused connection remains reusable.23
*/24
public val idleTimeout: Duration = Duration.seconds(60L),25
/**26
* Optional maximum connection age before retirement; existing active work follows normal27
* draining rules.28
*/29
public val maxLifetime: Duration? = None30
) {31
init {32
if (maxConnectionsPerOrigin <= 0L || maxConnections <= 0L || maxStreamsPerHttp2 <= 0L)33
throw IllegalArgumentException(34
Some("HTTP connection and stream limits must be positive")35
)36
if (37
idleTimeout <38
Duration.ZERO ||39
(clientPresent(maxLifetime) && maxLifetime!! <= Duration.ZERO)40
)41
throw IllegalArgumentException(Some("invalid HTTP connection lifetime"))42
}43
}