public class ConnectionPool extends Object
| Modifier and Type | Field and Description |
|---|---|
private Map<ConnectionKey,LinkedList<PooledConnection>> |
cache
Map containing the lists of connections for each identity
|
(package private) int |
maxFreeConnections
Maximum number of free connections for an identity in the pool
|
| Constructor and Description |
|---|
ConnectionPool(int maxFreeConnections)
Creates a new pool of connections.
|
| Modifier and Type | Method and Description |
|---|---|
PooledConnection |
alloc(String name,
String password)
Allocates a Connection for the specified identity.
|
void |
free(PooledConnection cnx)
Frees the specified connection, depending of the number of free connections
in the pool this connection is closed or inserted in the pool.
|
int |
getMaxFreeConnections()
Gets the maximum number of free connections for an identity in the pool.
|
void |
setMaxFreeConnections(int maxFreeConnections)
Returns the maximum number of free connections for an identity in the pool.
|
int maxFreeConnections
private Map<ConnectionKey,LinkedList<PooledConnection>> cache
public ConnectionPool(int maxFreeConnections)
maxFreeConnections - the maximum number of free connections for an identity in the pool.public int getMaxFreeConnections()
public void setMaxFreeConnections(int maxFreeConnections)
maxFreeConnections - the maxFreeConnections to setpublic PooledConnection alloc(String name, String password)
name - name of user.password - password of user.public void free(PooledConnection cnx) throws jakarta.jms.JMSException
cnx - The connection to free.jakarta.jms.JMSException - an error occurs during the cleanup of the connection.Copyright © 2023 ScalAgent D.T.. All rights reserved.