类 ConnectionPool

java.lang.Object
com.lark.oapi.okhttp.ConnectionPool

public final class ConnectionPool extends Object
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.
  • 构造器详细资料

    • ConnectionPool

      public ConnectionPool()
      Create a new connection pool with tuning parameters appropriate for a single-user application. The tuning parameters in this pool are subject to change in future OkHttp releases. Currently this pool holds up to 5 idle connections which will be evicted after 5 minutes of inactivity.
    • ConnectionPool

      public ConnectionPool(int maxIdleConnections, long keepAliveDuration, TimeUnit timeUnit)
  • 方法详细资料

    • idleConnectionCount

      public int idleConnectionCount()
      Returns the number of idle connections in the pool.
    • connectionCount

      public int connectionCount()
      Returns total number of connections in the pool.
    • evictAll

      public void evictAll()
      Close and remove all idle connections in the pool.