Package eu.antidotedb.client
Class ConnectionPool
- java.lang.Object
-
- eu.antidotedb.client.ConnectionPool
-
public class ConnectionPool extends java.lang.Object
The 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 boolean
checkHealth(ConnectionPool p)
int
getActiveConnections()
Returns the number of currently active connections.Connection
getConnection()
returns a connection from the poolint
getCurrentPoolSize()
Number of connections generated so far.java.net.InetSocketAddress
getInetSocketAddress()
The IP Socket Address.int
getInitialPoolSize()
Number of connections that should be created initially.int
getMaxPoolSize()
Maximum number of connections that the pool can have.boolean
isHealthy()
Checks if is healthy.void
surrenderConnection(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.
-
-