Joram 5.3.0

org.objectweb.joram.client.jms.pool
Class ConnectionPool

java.lang.Object
  extended by org.objectweb.joram.client.jms.pool.ConnectionPool

public class ConnectionPool
extends java.lang.Object

Implements a pool of connection resulting of a unique ConnectionFactory object. Connections are sorted by identity.


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
 

Constructor Detail

ConnectionPool

public ConnectionPool(int maxFreeConnections)
Creates a new pool of connections.

Parameters:
maxFreeConnections - the maximum number of free connections for an identity in the pool.
Method Detail

getMaxFreeConnections

public int getMaxFreeConnections()
Gets the maximum number of free connections for an identity in the pool.

Returns:
the maxFreeConnections

setMaxFreeConnections

public void setMaxFreeConnections(int maxFreeConnections)
Returns the maximum number of free connections for an identity in the pool.

Parameters:
maxFreeConnections - the maxFreeConnections to set

alloc

public PooledConnection alloc(java.lang.String name,
                              java.lang.String password)
Allocates a Connection for the specified identity.

Parameters:
name - name of user.
password - password of user.
Returns:
A connection for the specified identity.

free

public void free(PooledConnection cnx)
          throws javax.jms.JMSException
Frees the specified connection, depending of the number of free connections in the pool this connection is closed or inserted in the pool.

Parameters:
cnx - The connection to free.
Throws:
javax.jms.JMSException - an error occurs during the cleanup of the connection.

Joram 5.3.0

Copyright © 2000 - 2009 Scalagent D.T. - All rights reserved