public class TestHostConnectionPool extends java.lang.Object implements HostConnectionPool<TestClient>
| Constructor and Description |
|---|
TestHostConnectionPool(Host host) |
| 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<TestClient> |
borrowConnection(int timeout)
Borrow a connection from the host.
|
boolean |
closeConnection(Connection<TestClient> 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<TestClient> connection)
Return a connection to the host's pool.
|
void |
shutdown()
Completely shut down this connection pool as part of a client shutdown
|
public TestHostConnectionPool(Host host)
public Connection<TestClient> borrowConnection(int timeout) throws ConnectionException
HostConnectionPoolborrowConnection in interface HostConnectionPool<TestClient>ConnectionExceptionpublic boolean returnConnection(Connection<TestClient> connection)
HostConnectionPoolreturnConnection in interface HostConnectionPool<TestClient>public void markAsDown(ConnectionException reason)
HostConnectionPoolmarkAsDown in interface HostConnectionPool<TestClient>public void shutdown()
HostConnectionPoolshutdown in interface HostConnectionPool<TestClient>public int primeConnections(int numConnections)
throws ConnectionException,
java.lang.InterruptedException
HostConnectionPoolprimeConnections in interface HostConnectionPool<TestClient>ConnectionExceptionjava.lang.InterruptedExceptionpublic Host getHost()
getHost in interface HostConnectionPool<TestClient>public int getActiveConnectionCount()
getActiveConnectionCount in interface HostConnectionPool<TestClient>public int getPendingConnectionCount()
getPendingConnectionCount in interface HostConnectionPool<TestClient>public int getBlockedThreadCount()
getBlockedThreadCount in interface HostConnectionPool<TestClient>public int getIdleConnectionCount()
getIdleConnectionCount in interface HostConnectionPool<TestClient>public int getBusyConnectionCount()
getBusyConnectionCount in interface HostConnectionPool<TestClient>public boolean isReconnecting()
isReconnecting in interface HostConnectionPool<TestClient>public double getScore()
getScore in interface HostConnectionPool<TestClient>public void addLatencySample(long lastLatency,
long now)
HostConnectionPooladdLatencySample in interface HostConnectionPool<TestClient>public boolean closeConnection(Connection<TestClient> connection)
HostConnectionPoolcloseConnection in interface HostConnectionPool<TestClient>public int getOpenedConnectionCount()
getOpenedConnectionCount in interface HostConnectionPool<TestClient>public int getFailedOpenConnectionCount()
getFailedOpenConnectionCount in interface HostConnectionPool<TestClient>public int getClosedConnectionCount()
getClosedConnectionCount in interface HostConnectionPool<TestClient>public int getErrorsSinceLastSuccess()
getErrorsSinceLastSuccess in interface HostConnectionPool<TestClient>public boolean isActive()
isActive in interface HostConnectionPool<TestClient>public boolean isShutdown()
isShutdown in interface HostConnectionPool<TestClient>public int getConnectAttemptCount()
getConnectAttemptCount in interface HostConnectionPool<TestClient>