ConnectionPool
class ConnectionPool
Manages reuse of HTTP and HTTP/2 connections for reduced network latency. HTTP requests that share the same Address may share a Connection. This class implements the policy of which connections to keep open for future use.
Constructors
Link copied to clipboard
constructor(maxIdleConnections: Int = 5, keepAliveDuration: Long = 5, timeUnit: TimeUnit = TimeUnit.MINUTES, connectionListener: ConnectionListener = ConnectionListener.NONE)
constructor()
Types
Link copied to clipboard
class AddressPolicy(val minimumConcurrentCalls: Int = 0, val backoffDelayMillis: Long = 60 * 1000, val backoffJitterMillis: Int = 100)
A policy for how the pool should treat a specific address.
Functions
Link copied to clipboard
Returns total number of connections in the pool.
Link copied to clipboard
Returns the number of idle connections in the pool.
Link copied to clipboard
Sets a policy that applies to address. Overwrites any existing policy for that address.