Interface ConnectionPool
- All Known Implementing Classes:
 AbstractConnectionPool, DuplexConnectionPool, MultiplexConnectionPool, RandomConnectionPool, RoundRobinConnectionPool, ValidatingConnectionPool
public interface ConnectionPool
Client-side connection pool abstraction.
- 
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceFactory for ConnectionPool instances.static interfaceMarks a connection as supporting multiplexed requests.static interfaceMarks a connection as being usable for a maximum number of requests. - 
Method Summary
Modifier and TypeMethodDescriptionbooleanaccept(Connection connection) Accepts the given connection to be managed by this ConnectionPool.acquire(boolean create) Returns an idle connection, if available; if an idle connection is not available, and the givencreateparameter istrue, then schedules the opening of a new connection, if possible within the configuration of this connection pool (for example, if it does not exceed the max connection count); otherwise returnsnull.booleanisActive(Connection connection) booleanisEmpty()default CompletableFuture<Void> preCreateConnections(int connectionCount) Optionally pre-create up toconnectionCountconnections so they are immediately ready for use.booleanrelease(Connection connection) Returns the given connection, previously obtained viaacquire(boolean), back to this ConnectionPool.booleanremove(Connection connection) Removes the given connection from this ConnectionPool. 
- 
Method Details
- 
preCreateConnections
Optionally pre-create up toconnectionCountconnections so they are immediately ready for use.- Parameters:
 connectionCount- the number of connections to pre-start.
 - 
isActive
- Parameters:
 connection- the connection to test- Returns:
 - whether the given connection is currently in use
 
 - 
isEmpty
boolean isEmpty()- Returns:
 - whether this ConnectionPool has no open connections
 
 - 
acquire
Returns an idle connection, if available; if an idle connection is not available, and the given
createparameter istrue, then schedules the opening of a new connection, if possible within the configuration of this connection pool (for example, if it does not exceed the max connection count); otherwise returnsnull.- Parameters:
 create- whether to schedule the opening of a connection if no idle connections are available- Returns:
 - an idle connection or 
nullif no idle connections are available 
 - 
accept
Accepts the given connection to be managed by this ConnectionPool.
- Parameters:
 connection- the connection to accept- Returns:
 - whether the connection has been accepted
 
 - 
release
Returns the given connection, previously obtained via
acquire(boolean), back to this ConnectionPool.- Parameters:
 connection- the connection to release- Returns:
 - true if the connection has been released, false if the connection should be closed
 
 - 
remove
Removes the given connection from this ConnectionPool.
- Parameters:
 connection- the connection to remove- Returns:
 - true if the connection was removed from this ConnectionPool
 
 
 -