org.apache.activemq.pool
Class PooledConnectionFactory

java.lang.Object
  extended by org.apache.activemq.pool.PooledConnectionFactory
All Implemented Interfaces:
ConnectionFactory, Service
Direct Known Subclasses:
AmqJNDIPooledConnectionFactory, XaPooledConnectionFactory

public class PooledConnectionFactory
extends Object
implements ConnectionFactory, Service

A JMS provider which pools Connection, Session and MessageProducer instances so it can be used with tools like Spring's JmsTemplate. NOTE this implementation is only intended for use when sending messages. It does not deal with pooling of consumers; for that look at a library like Jencks such as in this example

Version:
$Revision: 1.1 $

Constructor Summary
PooledConnectionFactory()
           
PooledConnectionFactory(ActiveMQConnectionFactory connectionFactory)
           
PooledConnectionFactory(String brokerURL)
           
 
Method Summary
 Connection createConnection()
           
protected  ActiveMQConnection createConnection(ConnectionKey key)
           
 Connection createConnection(String userName, String password)
           
protected  ConnectionPool createConnectionPool(ActiveMQConnection connection)
           
protected  ObjectPoolFactory createPoolFactory()
           
 ConnectionFactory getConnectionFactory()
           
 int getIdleTimeout()
           
 int getMaxConnections()
           
 int getMaximumActive()
           
 ObjectPoolFactory getPoolFactory()
           
 void setConnectionFactory(ConnectionFactory connectionFactory)
           
 void setIdleTimeout(int idleTimeout)
           
 void setMaxConnections(int maxConnections)
           
 void setMaximumActive(int maximumActive)
          Sets the maximum number of active sessions per connection
 void setPoolFactory(ObjectPoolFactory poolFactory)
          Sets the object pool factory used to create individual session pools for each connection
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PooledConnectionFactory

public PooledConnectionFactory()

PooledConnectionFactory

public PooledConnectionFactory(String brokerURL)

PooledConnectionFactory

public PooledConnectionFactory(ActiveMQConnectionFactory connectionFactory)
Method Detail

getConnectionFactory

public ConnectionFactory getConnectionFactory()

setConnectionFactory

public void setConnectionFactory(ConnectionFactory connectionFactory)

createConnection

public Connection createConnection()
                            throws JMSException
Specified by:
createConnection in interface ConnectionFactory
Throws:
JMSException

createConnection

public Connection createConnection(String userName,
                                   String password)
                            throws JMSException
Specified by:
createConnection in interface ConnectionFactory
Throws:
JMSException

createConnectionPool

protected ConnectionPool createConnectionPool(ActiveMQConnection connection)

createConnection

protected ActiveMQConnection createConnection(ConnectionKey key)
                                       throws JMSException
Throws:
JMSException

start

public void start()
Specified by:
start in interface Service
See Also:
org.apache.activemq.service.Service#start()

stop

public void stop()
Specified by:
stop in interface Service

getPoolFactory

public ObjectPoolFactory getPoolFactory()

setPoolFactory

public void setPoolFactory(ObjectPoolFactory poolFactory)
Sets the object pool factory used to create individual session pools for each connection


getMaximumActive

public int getMaximumActive()

setMaximumActive

public void setMaximumActive(int maximumActive)
Sets the maximum number of active sessions per connection


getMaxConnections

public int getMaxConnections()
Returns:
the maxConnections

setMaxConnections

public void setMaxConnections(int maxConnections)
Parameters:
maxConnections - the maxConnections to set

createPoolFactory

protected ObjectPoolFactory createPoolFactory()

getIdleTimeout

public int getIdleTimeout()

setIdleTimeout

public void setIdleTimeout(int idleTimeout)


Copyright © 2005-2011 Apache Software Foundation. All Rights Reserved.