|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.joram.client.jms.pool.ConnectionPool
public class ConnectionPool
Implements a pool of connection resulting of a unique ConnectionFactory object. Connections are sorted by identity.
Field Summary | |
---|---|
private java.util.Map<ConnectionKey,java.util.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 Summary | |
---|---|
ConnectionPool(int maxFreeConnections)
Creates a new pool of connections. |
Method Summary | |
---|---|
PooledConnection |
alloc(java.lang.String name,
java.lang.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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
int maxFreeConnections
private java.util.Map<ConnectionKey,java.util.LinkedList<PooledConnection>> cache
Constructor Detail |
---|
public ConnectionPool(int maxFreeConnections)
maxFreeConnections
- the maximum number of free connections for an identity in the pool.Method Detail |
---|
public int getMaxFreeConnections()
public void setMaxFreeConnections(int maxFreeConnections)
maxFreeConnections
- the maxFreeConnections to setpublic PooledConnection alloc(java.lang.String name, java.lang.String password)
name
- name of user.password
- password of user.
public void free(PooledConnection cnx) throws javax.jms.JMSException
cnx
- The connection to free.
javax.jms.JMSException
- an error occurs during the cleanup of the connection.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |