CL - public interface HostConnectionPool<CL>
Connection(s) for a single Host
The interface prescribes certain key features required by clients of this class, such as
Connection life cycle management such as borrow / return / close / markAsDown Host associated with the connection pool. HostConnectionPool tracked by a
ConnectionPool for all the Host(s) within a cassandra cluster.SimpleHostConnectionPool} for sample implementations of this class.,
ConnectionPool} for references to this class.| Modifier and Type | Method and Description |
|---|---|
void |
addLatencySample(long lastLatency,
long now)
Add a single latency sample after an operation on a connection belonging
to this pool
|
Connection<CL> |
borrowConnection(int timeout)
Borrow a connection from the host.
|
boolean |
closeConnection(Connection<CL> connection)
Close this connection and update internal state
|
int |
getActiveConnectionCount() |
int |
getBlockedThreadCount() |
int |
getBusyConnectionCount() |
int |
getClosedConnectionCount() |
int |
getConnectAttemptCount() |
int |
getErrorsSinceLastSuccess() |
int |
getFailedOpenConnectionCount() |
Host |
getHost() |
int |
getIdleConnectionCount() |
int |
getOpenedConnectionCount() |
int |
getPendingConnectionCount() |
double |
getScore() |
boolean |
isActive() |
boolean |
isReconnecting() |
boolean |
isShutdown() |
void |
markAsDown(ConnectionException reason)
Shut down the host so no more connections may be created when
borrowConnections is called and connections will be terminated when
returnConnection is called.
|
int |
primeConnections(int numConnections)
Create numConnections new connections and add them to the
|
boolean |
returnConnection(Connection<CL> connection)
Return a connection to the host's pool.
|
void |
shutdown()
Completely shut down this connection pool as part of a client shutdown
|
Connection<CL> borrowConnection(int timeout) throws ConnectionException
timeout - ConnectionExceptionboolean returnConnection(Connection<CL> connection)
connection - boolean closeConnection(Connection<CL> connection)
connection - void markAsDown(ConnectionException reason)
void shutdown()
int primeConnections(int numConnections)
throws ConnectionException,
java.lang.InterruptedException
ConnectionExceptionjava.lang.InterruptedExceptionHost getHost()
int getActiveConnectionCount()
int getPendingConnectionCount()
int getBlockedThreadCount()
int getIdleConnectionCount()
int getBusyConnectionCount()
boolean isReconnecting()
boolean isActive()
boolean isShutdown()
double getScore()
void addLatencySample(long lastLatency,
long now)
lastLatency - int getOpenedConnectionCount()
int getFailedOpenConnectionCount()
int getClosedConnectionCount()
int getErrorsSinceLastSuccess()
int getConnectAttemptCount()