org.apache.activemq.pool
Class PooledConnectionFactory

java.lang.Object
  extended by org.apache.activemq.pool.PooledConnectionFactory
All Implemented Interfaces:
javax.jms.ConnectionFactory, Service

public class PooledConnectionFactory
extends java.lang.Object
implements javax.jms.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(java.lang.String brokerURL)
           
 
Method Summary
 javax.jms.Connection createConnection()
           
protected  ActiveMQConnection createConnection(ConnectionKey key)
           
 javax.jms.Connection createConnection(java.lang.String userName, java.lang.String password)
           
protected  org.apache.commons.pool.ObjectPoolFactory createPoolFactory()
           
 ActiveMQConnectionFactory getConnectionFactory()
           
 int getMaximumActive()
           
 org.apache.commons.pool.ObjectPoolFactory getPoolFactory()
           
 void setConnectionFactory(ActiveMQConnectionFactory connectionFactory)
           
 void setMaximumActive(int maximumActive)
          Sets the maximum number of active sessions per connection
 void setPoolFactory(org.apache.commons.pool.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(java.lang.String brokerURL)

PooledConnectionFactory

public PooledConnectionFactory(ActiveMQConnectionFactory connectionFactory)
Method Detail

getConnectionFactory

public ActiveMQConnectionFactory getConnectionFactory()

setConnectionFactory

public void setConnectionFactory(ActiveMQConnectionFactory connectionFactory)

createConnection

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

createConnection

public javax.jms.Connection createConnection(java.lang.String userName,
                                             java.lang.String password)
                                      throws javax.jms.JMSException
Specified by:
createConnection in interface javax.jms.ConnectionFactory
Throws:
javax.jms.JMSException

createConnection

protected ActiveMQConnection createConnection(ConnectionKey key)
                                       throws javax.jms.JMSException
Throws:
javax.jms.JMSException

start

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

stop

public void stop()
          throws java.lang.Exception
Specified by:
stop in interface Service
Throws:
java.lang.Exception

getPoolFactory

public org.apache.commons.pool.ObjectPoolFactory getPoolFactory()

setPoolFactory

public void setPoolFactory(org.apache.commons.pool.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


createPoolFactory

protected org.apache.commons.pool.ObjectPoolFactory createPoolFactory()


Copyright © 2009 Apache Software Foundation. All Rights Reserved.