Package eu.antidotedb.client
Class ConnectionPool
- java.lang.Object
-
- eu.antidotedb.client.ConnectionPool
-
public class ConnectionPool extends java.lang.ObjectThe Class ConnectionPool.
-
-
Constructor Summary
Constructors Constructor Description ConnectionPool(int maxPoolSize, int initialPoolSize, java.net.InetSocketAddress inetAddr, java.util.List<TransformerFactory> transformerFactories)Instantiates a new connection pool.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckHealth(ConnectionPool p)intgetActiveConnections()Returns the number of currently active connections.ConnectiongetConnection()returns a connection from the poolintgetCurrentPoolSize()Number of connections generated so far.java.net.InetSocketAddressgetInetSocketAddress()The IP Socket Address.intgetInitialPoolSize()Number of connections that should be created initially.intgetMaxPoolSize()Maximum number of connections that the pool can have.booleanisHealthy()Checks if is healthy.voidsurrenderConnection(Connection s)Surrender connection.
-
-
-
Constructor Detail
-
ConnectionPool
public ConnectionPool(int maxPoolSize, int initialPoolSize, java.net.InetSocketAddress inetAddr, java.util.List<TransformerFactory> transformerFactories)Instantiates a new connection pool.- Parameters:
maxPoolSize- the max pool sizeinitialPoolSize- the initial pool sizeinetAddr- the IP Socket AddresstransformerFactories- factories for creating request transformers
-
-
Method Detail
-
checkHealth
public boolean checkHealth(ConnectionPool p)
-
getConnection
public Connection getConnection() throws java.lang.InterruptedException
returns a connection from the pool- Throws:
java.lang.InterruptedException
-
surrenderConnection
public void surrenderConnection(Connection s)
Surrender connection.- Parameters:
s- the s
-
isHealthy
public boolean isHealthy()
Checks if is healthy.- Returns:
- true, if is healthy
-
getInetSocketAddress
public java.net.InetSocketAddress getInetSocketAddress()
The IP Socket Address.
-
getMaxPoolSize
public int getMaxPoolSize()
Maximum number of connections that the pool can have.
-
getInitialPoolSize
public int getInitialPoolSize()
Number of connections that should be created initially.
-
getCurrentPoolSize
public int getCurrentPoolSize()
Number of connections generated so far.
-
getActiveConnections
public int getActiveConnections()
Returns the number of currently active connections.
-
-