org.jencks.amqpool
Class PooledConnectionFactory

java.lang.Object
  extended by org.jencks.amqpool.PooledConnectionFactory
All Implemented Interfaces:
javax.jms.ConnectionFactory, org.apache.activemq.Service
Direct Known Subclasses:
XaPooledConnectionFactory

public class PooledConnectionFactory
extends java.lang.Object
implements javax.jms.ConnectionFactory, org.apache.activemq.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: 171 $

Constructor Summary
PooledConnectionFactory()
           
PooledConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory connectionFactory)
           
PooledConnectionFactory(java.lang.String brokerURL)
           
 
Method Summary
 javax.jms.Connection createConnection()
           
protected  org.apache.activemq.ActiveMQConnection createConnection(ConnectionKey key)
           
 javax.jms.Connection createConnection(java.lang.String userName, java.lang.String password)
           
protected  ConnectionPool createConnectionPool(org.apache.activemq.ActiveMQConnection connection)
           
protected  org.apache.commons.pool.ObjectPoolFactory createPoolFactory()
           
 javax.jms.ConnectionFactory getConnectionFactory()
           
 int getMaxConnections()
           
 int getMaximumActive()
           
 org.apache.commons.pool.ObjectPoolFactory getPoolFactory()
           
 void setConnectionFactory(javax.jms.ConnectionFactory connectionFactory)
           
 void setMaxConnections(int maxConnections)
           
 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(org.apache.activemq.ActiveMQConnectionFactory connectionFactory)
Method Detail

getConnectionFactory

public javax.jms.ConnectionFactory getConnectionFactory()

setConnectionFactory

public void setConnectionFactory(javax.jms.ConnectionFactory 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

createConnectionPool

protected ConnectionPool createConnectionPool(org.apache.activemq.ActiveMQConnection connection)

createConnection

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

start

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

stop

public void stop()
          throws java.lang.Exception
Specified by:
stop in interface org.apache.activemq.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


getMaxConnections

public int getMaxConnections()
Returns:
the maxConnections

setMaxConnections

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

createPoolFactory

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


Copyright © 2009 LogicBlaze, Inc.. All Rights Reserved.