public final class ConnectionPool extends Object
Address may share a Connection. This class implements the policy
of which connections to keep open for future use.| Modifier and Type | Field and Description |
|---|---|
RouteDatabase |
routeDatabase |
| Constructor and Description |
|---|
ConnectionPool()
Create a new connection pool with tuning parameters appropriate for a single-user application.
|
ConnectionPool(int maxIdleConnections,
long keepAliveDuration,
TimeUnit timeUnit) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
connectionBecameIdle(RealConnection connection) |
int |
connectionCount() |
Socket |
deduplicate(Address address,
StreamAllocation streamAllocation) |
void |
evictAll() |
RealConnection |
get(Address address,
StreamAllocation streamAllocation,
Route route) |
int |
idleConnectionCount() |
void |
put(RealConnection connection) |
public final RouteDatabase routeDatabase
public ConnectionPool()
public ConnectionPool(int maxIdleConnections,
long keepAliveDuration,
TimeUnit timeUnit)
public int idleConnectionCount()
public int connectionCount()
idleConnectionCount() to count connections not currently
in use.public RealConnection get(Address address, StreamAllocation streamAllocation, Route route)
public Socket deduplicate(Address address, StreamAllocation streamAllocation)
public void put(RealConnection connection)
public boolean connectionBecameIdle(RealConnection connection)
public void evictAll()
Copyright © 2019. All rights reserved.