|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.netflix.astyanax.connectionpool.impl.SimpleHostConnectionPool<CL>
public class SimpleHostConnectionPool<CL>
Pool of connections for a single host. Features 1. Async open connection 2.
Nested Class Summary | |
---|---|
static interface |
SimpleHostConnectionPool.Listener<CL>
Interface to notify the owning connection pool of up/down state changes. |
Field Summary | |
---|---|
protected ConnectionPoolConfiguration |
config
|
Constructor Summary | |
---|---|
SimpleHostConnectionPool(Host host,
ConnectionFactory<CL> factory,
ConnectionPoolMonitor monitor,
ConnectionPoolConfiguration config,
SimpleHostConnectionPool.Listener<CL> listener)
|
Method Summary | |
---|---|
void |
addLatencySample(long latency,
long now)
Add a single latency sample after an operation on a connection belonging to this pool |
Connection<CL> |
borrowConnection(int timeout)
Create a connection as long the max hasn't been reached |
boolean |
closeConnection(Connection<CL> connection)
Close this connection and update internal state |
int |
getActiveConnectionCount()
Get number of open connections including any that are currently borrowed and those that are currently idel |
int |
getBlockedThreadCount()
Get number of threads blocked waiting for a free connection |
int |
getBusyConnectionCount()
Get number of currently borrowed connections |
Host |
getHost()
Get the host to which this pool is associated |
int |
getIdleConnectionCount()
Return the number of idle active connections. |
double |
getMeanLatency()
Get the average latency as calculated by the scoring strategy |
int |
getPendingConnectionCount()
Get the number of pending connection open attempts |
double |
getScore()
Return implementation specific score to be used by weighted pool selection algorithms |
int |
growConnections(int numConnections)
Create numConnections new connections and add them to the |
boolean |
isShutdown()
Determine if pool is shut down. |
void |
markAsDown(ConnectionException reason)
Mark the host as down. |
Connection<CL> |
openConnection()
Open a new connection synchronously |
boolean |
returnConnection(Connection<CL> connection)
Return a connection to this host |
void |
shutdown()
Completely shut down this connection pool as part of a client shutdown |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final ConnectionPoolConfiguration config
Constructor Detail |
---|
public SimpleHostConnectionPool(Host host, ConnectionFactory<CL> factory, ConnectionPoolMonitor monitor, ConnectionPoolConfiguration config, SimpleHostConnectionPool.Listener<CL> listener)
Method Detail |
---|
public int growConnections(int numConnections) throws ConnectionException, InterruptedException
HostConnectionPool
growConnections
in interface HostConnectionPool<CL>
ConnectionException
InterruptedException
public Connection<CL> borrowConnection(int timeout) throws ConnectionException
borrowConnection
in interface HostConnectionPool<CL>
timeout
- - Max wait timeout if max connections have been allocated
and pool is empty. 0 to throw a MaxConnsPerHostReachedException.
TimeoutException
- if timeout specified and no new connection is available
MaxConnsPerHostReachedException if max connections created and no
timeout was specified
ConnectionException
public boolean returnConnection(Connection<CL> connection)
returnConnection
in interface HostConnectionPool<CL>
connection
-
public boolean closeConnection(Connection<CL> connection)
HostConnectionPool
closeConnection
in interface HostConnectionPool<CL>
public void markAsDown(ConnectionException reason)
markAsDown
in interface HostConnectionPool<CL>
public void shutdown()
HostConnectionPool
shutdown
in interface HostConnectionPool<CL>
public Connection<CL> openConnection() throws ConnectionException
openConnection
in interface HostConnectionPool<CL>
ConnectionException
public boolean isShutdown()
HostConnectionPool
isShutdown
in interface HostConnectionPool<CL>
public Host getHost()
HostConnectionPool
getHost
in interface HostConnectionPool<CL>
public int getActiveConnectionCount()
HostConnectionPool
getActiveConnectionCount
in interface HostConnectionPool<CL>
public int getIdleConnectionCount()
HostConnectionPool
getIdleConnectionCount
in interface HostConnectionPool<CL>
public int getPendingConnectionCount()
HostConnectionPool
getPendingConnectionCount
in interface HostConnectionPool<CL>
public int getBlockedThreadCount()
HostConnectionPool
getBlockedThreadCount
in interface HostConnectionPool<CL>
public int getBusyConnectionCount()
HostConnectionPool
getBusyConnectionCount
in interface HostConnectionPool<CL>
public double getScore()
HostConnectionPool
getScore
in interface HostConnectionPool<CL>
public double getMeanLatency()
HostConnectionPool
getMeanLatency
in interface HostConnectionPool<CL>
public void addLatencySample(long latency, long now)
HostConnectionPool
addLatencySample
in interface HostConnectionPool<CL>
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |