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

java.lang.Object
  extended by org.objectweb.joram.client.jms.pool.PooledConnectionFactory
All Implemented Interfaces:
javax.jms.ConnectionFactory

public class PooledConnectionFactory
extends java.lang.Object
implements javax.jms.ConnectionFactory

A ConnectionFactory which pools Connection for reuse.


Constructor Summary
PooledConnectionFactory(javax.jms.ConnectionFactory cf)
          Creates a new pool for the specified ConnectionFactory.
PooledConnectionFactory(javax.jms.ConnectionFactory cf, int maxFreeConnections)
          Creates a new pool for the specified ConnectionFactory.
 
Method Summary
 javax.jms.Connection createConnection()
          API method, creates a connection with the default user identity.
 javax.jms.Connection createConnection(java.lang.String name, java.lang.String password)
          API method, creates a connection with the specified user identity.
protected  ConnectionPool createConnectionPool(int maxFreeConnections)
           
 ConnectionFactory getConnectionFactory()
          Returns the underlying ConnectionFactory used to create the connections.
 int getMaxFreeConnections()
          Returns the maximum number of free connections for an identity in the pool.
 void setMaxFreeConnections(int maxFreeConnections)
          Sets 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

PooledConnectionFactory

public PooledConnectionFactory(javax.jms.ConnectionFactory cf)
Creates a new pool for the specified ConnectionFactory.

Parameters:
cf - The ConnectionFactory used to really create the connections.

PooledConnectionFactory

public PooledConnectionFactory(javax.jms.ConnectionFactory cf,
                               int maxFreeConnections)
Creates a new pool for the specified ConnectionFactory.

Parameters:
cf - The ConnectionFactory used to really create the connections.
maxFreeConnections - The maximum number of free connections for an identity in the pool.
Method Detail

getConnectionFactory

public ConnectionFactory getConnectionFactory()
Returns the underlying ConnectionFactory used to create the connections. This ConnectionFactory object allows to configure the created connections.

Returns:
the underlying ConnectionFactory.

getMaxFreeConnections

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

Returns:
The maximum number of free connections in the pool.

setMaxFreeConnections

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

Parameters:
maxFreeConnections - the maximum number of free connections to set

createConnection

public javax.jms.Connection createConnection()
                                      throws javax.jms.JMSException
API method, creates a connection with the default user identity. The connection is created in stopped mode.

Specified by:
createConnection in interface javax.jms.ConnectionFactory
Returns:
a newly created connection.
Throws:
javax.jms.JMSSecurityException - If the default identification is incorrect.
java.lang.IllegalStateException - If the server is not listening.
javax.jms.JMSException
See Also:
ConnectionFactory.createConnection()

createConnection

public javax.jms.Connection createConnection(java.lang.String name,
                                             java.lang.String password)
                                      throws javax.jms.JMSException
API method, creates a connection with the specified user identity. The connection is created in stopped mode.

Specified by:
createConnection in interface javax.jms.ConnectionFactory
Parameters:
name - the caller's user name.
password - the caller's password.
Returns:
a newly created connection.
Throws:
javax.jms.JMSSecurityException - If the user identification is incorrect.
java.lang.IllegalStateException - If the server is not listening.
javax.jms.JMSException
See Also:
ConnectionFactory.createConnection(String, String)

createConnectionPool

protected ConnectionPool createConnectionPool(int maxFreeConnections)
Parameters:
maxFreeConnections - The maximum number of free connections for an identity in the pool.
Returns:
The


Copyright © 2011 ScalAgent D.T.. All Rights Reserved.