bitronix.tm.resource.jms
Class PoolingConnectionFactory

java.lang.Object
  extended bybitronix.tm.resource.common.ResourceBean
      extended bybitronix.tm.resource.jms.PoolingConnectionFactory
All Implemented Interfaces:
javax.jms.ConnectionFactory, javax.naming.Referenceable, java.io.Serializable, XAResourceProducer

public class PoolingConnectionFactory
extends ResourceBean
implements javax.jms.ConnectionFactory, XAResourceProducer

Implementation of a JMS ConnectionFactory wrapping vendor's XAConnectionFactory implementation.

© Bitronix 2005, 2006, 2007

Author:
lorban
See Also:
Serialized Form

Constructor Summary
PoolingConnectionFactory()
           
 
Method Summary
 void close()
          Release this XAResourceProducer's internal resources.
 javax.jms.Connection createConnection()
           
 javax.jms.Connection createConnection(java.lang.String userName, java.lang.String password)
           
 XAStatefulHolder createPooledConnection(java.lang.Object xaFactory, ResourceBean bean)
          Create a XAStatefulHolder that will be placed in an XAPool.
 XAResourceProducer createResource()
          Create the resource wrapper described by this bean.
 void endRecovery()
          Release internal resources held after call to startRecovery().
 XAResourceHolder findXAResourceHolder(javax.transaction.xa.XAResource xaResource)
          Find in the XAResourceHolders created by this XAResourceProducer the one which this XAResource belongs to.
 boolean getCacheProducersConsumers()
           
 java.lang.String getPassword()
           
 javax.naming.Reference getReference()
          PoolingConnectionFactory must alway have a unique name so this method builds a reference to this object using the unique name as RefAddr.
 java.util.Properties getServerSessionPool()
           
 boolean getTestConnections()
           
 java.lang.String getUser()
           
 void init()
          Initialize the pool by creating the initial amount of connections.
 void setCacheProducersConsumers(boolean cacheProducersConsumers)
           
 void setPassword(java.lang.String password)
           
 void setServerSessionPool(java.util.Properties serverSessionPool)
           
 void setTestConnections(boolean testConnections)
           
 void setUser(java.lang.String user)
           
 XAResourceHolderState startRecovery()
          Prepare the recoverable XAResource producer for recovery.
 java.lang.String toString()
           
 
Methods inherited from class bitronix.tm.resource.common.ResourceBean
getAcquireIncrement, getAcquisitionInterval, getAcquisitionTimeout, getAllowLocalTransactions, getAutomaticEnlistingEnabled, getClassName, getDeferConnectionRelease, getDriverProperties, getMaxIdleTime, getMaxPoolSize, getMinPoolSize, getPoolSize, getUniqueName, getUseTmJoin, incCreatedResourcesCounter, setAcquireIncrement, setAcquisitionInterval, setAcquisitionTimeout, setAllowLocalTransactions, setAutomaticEnlistingEnabled, setClassName, setDeferConnectionRelease, setDriverProperties, setMaxIdleTime, setMaxPoolSize, setMinPoolSize, setPoolSize, setUniqueName, setUseTmJoin
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface bitronix.tm.resource.common.XAResourceProducer
getUniqueName
 

Constructor Detail

PoolingConnectionFactory

public PoolingConnectionFactory()
Method Detail

init

public void init()
Initialize the pool by creating the initial amount of connections.

Specified by:
init in interface XAResourceProducer

createResource

public XAResourceProducer createResource()
Deprecated. superceded by init().

Description copied from class: ResourceBean
Create the resource wrapper described by this bean.

Specified by:
createResource in class ResourceBean
Returns:
this.

getServerSessionPool

public java.util.Properties getServerSessionPool()

setServerSessionPool

public void setServerSessionPool(java.util.Properties serverSessionPool)

getCacheProducersConsumers

public boolean getCacheProducersConsumers()

setCacheProducersConsumers

public void setCacheProducersConsumers(boolean cacheProducersConsumers)

getTestConnections

public boolean getTestConnections()

setTestConnections

public void setTestConnections(boolean testConnections)

getUser

public java.lang.String getUser()

setUser

public void setUser(java.lang.String user)

getPassword

public java.lang.String getPassword()

setPassword

public void setPassword(java.lang.String password)

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

toString

public java.lang.String toString()

startRecovery

public XAResourceHolderState startRecovery()
Description copied from interface: XAResourceProducer
Prepare the recoverable XAResource producer for recovery.

Specified by:
startRecovery in interface XAResourceProducer
Returns:
a XAResourceHolderState object that can be used to call recover().

endRecovery

public void endRecovery()
Description copied from interface: XAResourceProducer
Release internal resources held after call to startRecovery().

Specified by:
endRecovery in interface XAResourceProducer

close

public void close()
Description copied from interface: XAResourceProducer
Release this XAResourceProducer's internal resources.

Specified by:
close in interface XAResourceProducer

createPooledConnection

public XAStatefulHolder createPooledConnection(java.lang.Object xaFactory,
                                               ResourceBean bean)
                                        throws java.lang.Exception
Description copied from interface: XAResourceProducer
Create a XAStatefulHolder that will be placed in an XAPool.

Specified by:
createPooledConnection in interface XAResourceProducer
Parameters:
xaFactory - the vendor's resource-specific XA factory.
bean - the resource-specific bean describing the resource parameters.
Returns:
a XAStatefulHolder that will be placed in an XAPool.
Throws:
java.lang.Exception - thrown when the XAStatefulHolder cannot be created.

findXAResourceHolder

public XAResourceHolder findXAResourceHolder(javax.transaction.xa.XAResource xaResource)
Description copied from interface: XAResourceProducer
Find in the XAResourceHolders created by this XAResourceProducer the one which this XAResource belongs to.

Specified by:
findXAResourceHolder in interface XAResourceProducer
Parameters:
xaResource - the XAResource to look for.
Returns:
the associated XAResourceHolder or null if the XAResource does not belong to this XAResourceProducer.

getReference

public javax.naming.Reference getReference()
                                    throws javax.naming.NamingException
PoolingConnectionFactory must alway have a unique name so this method builds a reference to this object using the unique name as RefAddr.

Specified by:
getReference in interface javax.naming.Referenceable
Returns:
a reference to this PoolingConnectionFactory.
Throws:
javax.naming.NamingException