Package bitronix.tm.resource.messaging
Class PoolingConnectionFactory
java.lang.Object
bitronix.tm.resource.common.ResourceBean
bitronix.tm.resource.messaging.PoolingConnectionFactory
- All Implemented Interfaces:
XAResourceProducer,PoolingConnectionFactoryMBean,jakarta.jms.ConnectionFactory,Serializable,Referenceable
public class PoolingConnectionFactory
extends ResourceBean
implements jakarta.jms.ConnectionFactory, XAResourceProducer, PoolingConnectionFactoryMBean
Implementation of a JMS
ConnectionFactory wrapping vendor's XAConnectionFactory implementation.- Author:
- lorban
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Release thisXAResourceProducer's internal resources.jakarta.jms.Connectionjakarta.jms.ConnectioncreateConnection(String userName, String password) jakarta.jms.JMSContextjakarta.jms.JMSContextcreateContext(int sessionMode) jakarta.jms.JMSContextcreateContext(String userName, String password) jakarta.jms.JMSContextcreateContext(String userName, String password, int sessionMode) createPooledConnection(Object xaFactory, ResourceBean bean) Create aXAStatefulHolderthat will be placed in anXAPool.voidRelease internal resources held after call tostartRecovery().findXAResourceHolder(XAResource xaResource) Find in theXAResourceHolders created by thisXAResourceProducerthe one which thisXAResourcebelongs to.booleanlongPoolingConnectionFactorymust alway have a unique name so this method builds a reference to this object using the unique name asRefAddr.booleanlonggetUser()voidinit()Initialize the pool by creating the initial amount of connections.booleanisFailed()voidreset()voidsetCacheProducersConsumers(boolean cacheProducersConsumers) voidsetConstructorArgs(Object... constructorArgs) voidsetFailed(boolean failed) Mark this resource producer as failed or not.voidsetPassword(String password) voidsetTestConnections(boolean testConnections) voidPrepare the recoverableXAResourceproducer for recovery.toString()Methods inherited from class bitronix.tm.resource.common.ResourceBean
getAcquireIncrement, getAcquisitionInterval, getAcquisitionTimeout, getAllowLocalTransactions, getApplyTransactionTimeout, getAutomaticEnlistingEnabled, getClassName, getDeferConnectionRelease, getDriverProperties, getIgnoreRecoveryFailures, getMaxIdleTime, getMaxPoolSize, getMinPoolSize, getShareTransactionConnections, getTwoPcOrderingPosition, getUniqueName, getUseTmJoin, incCreatedResourcesCounter, isDisabled, setAcquireIncrement, setAcquisitionInterval, setAcquisitionTimeout, setAllowLocalTransactions, setApplyTransactionTimeout, setAutomaticEnlistingEnabled, setClassName, setDeferConnectionRelease, setDisabled, setDriverProperties, setIgnoreRecoveryFailures, setMaxIdleTime, setMaxPoolSize, setMinPoolSize, setShareTransactionConnections, setTwoPcOrderingPosition, setUniqueName, setUseTmJoinMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface bitronix.tm.resource.messaging.PoolingConnectionFactoryMBean
getMaxPoolSize, getMinPoolSize, isDisabled, setDisabledMethods inherited from interface bitronix.tm.resource.common.XAResourceProducer
getUniqueName
-
Constructor Details
-
PoolingConnectionFactory
public PoolingConnectionFactory()
-
-
Method Details
-
init
public void init()Initialize the pool by creating the initial amount of connections.- Specified by:
initin interfaceXAResourceProducer
-
getCacheProducersConsumers
public boolean getCacheProducersConsumers() -
setCacheProducersConsumers
public void setCacheProducersConsumers(boolean cacheProducersConsumers) -
getTestConnections
public boolean getTestConnections() -
setTestConnections
public void setTestConnections(boolean testConnections) -
getUser
-
setUser
-
getPassword
-
setPassword
-
setConstructorArgs
-
createConnection
public jakarta.jms.Connection createConnection() throws jakarta.jms.JMSException- Specified by:
createConnectionin interfacejakarta.jms.ConnectionFactory- Throws:
jakarta.jms.JMSException
-
createConnection
public jakarta.jms.Connection createConnection(String userName, String password) throws jakarta.jms.JMSException - Specified by:
createConnectionin interfacejakarta.jms.ConnectionFactory- Throws:
jakarta.jms.JMSException
-
createContext
public jakarta.jms.JMSContext createContext()- Specified by:
createContextin interfacejakarta.jms.ConnectionFactory
-
createContext
- Specified by:
createContextin interfacejakarta.jms.ConnectionFactory
-
createContext
- Specified by:
createContextin interfacejakarta.jms.ConnectionFactory
-
createContext
public jakarta.jms.JMSContext createContext(int sessionMode) - Specified by:
createContextin interfacejakarta.jms.ConnectionFactory
-
toString
-
startRecovery
Description copied from interface:XAResourceProducerPrepare the recoverableXAResourceproducer for recovery.- Specified by:
startRecoveryin interfaceXAResourceProducer- Returns:
- a
XAResourceHolderStateobject that can be used to callrecover(). - Throws:
RecoveryException- thrown when aXAResourceHolderStatecannot be acquired.
-
endRecovery
Description copied from interface:XAResourceProducerRelease internal resources held after call tostartRecovery().- Specified by:
endRecoveryin interfaceXAResourceProducer- Throws:
RecoveryException- thrown when an error occured while releasing reserved resources.
-
setFailed
public void setFailed(boolean failed) Description copied from interface:XAResourceProducerMark this resource producer as failed or not. A resource is considered failed if recovery fails to run on it.- Specified by:
setFailedin interfaceXAResourceProducer- Parameters:
failed- true is the resource must be considered failed, false it it must be considered sane.
-
isFailed
public boolean isFailed()- Specified by:
isFailedin interfacePoolingConnectionFactoryMBean
-
close
public void close()Description copied from interface:XAResourceProducerRelease thisXAResourceProducer's internal resources.- Specified by:
closein interfaceXAResourceProducer
-
createPooledConnection
public XAStatefulHolder createPooledConnection(Object xaFactory, ResourceBean bean) throws Exception Description copied from interface:XAResourceProducerCreate aXAStatefulHolderthat will be placed in anXAPool.- Specified by:
createPooledConnectionin interfaceXAResourceProducer- Parameters:
xaFactory- the vendor's resource-specific XA factory.bean- the resource-specific bean describing the resource parameters.- Returns:
- a
XAStatefulHolderthat will be placed in anXAPool. - Throws:
Exception- thrown when theXAStatefulHoldercannot be created.
-
findXAResourceHolder
Description copied from interface:XAResourceProducerFind in theXAResourceHolders created by thisXAResourceProducerthe one which thisXAResourcebelongs to.- Specified by:
findXAResourceHolderin interfaceXAResourceProducer- Parameters:
xaResource- theXAResourceto look for.- Returns:
- the associated
XAResourceHolderor null if theXAResourcedoes not belong to thisXAResourceProducer.
-
getReference
PoolingConnectionFactorymust alway have a unique name so this method builds a reference to this object using the unique name asRefAddr.- Specified by:
getReferencein interfaceReferenceable- Returns:
- a reference to this
PoolingConnectionFactory. - Throws:
NamingException
-
getInPoolSize
public long getInPoolSize()- Specified by:
getInPoolSizein interfacePoolingConnectionFactoryMBean
-
getTotalPoolSize
public long getTotalPoolSize()- Specified by:
getTotalPoolSizein interfacePoolingConnectionFactoryMBean
-
reset
- Specified by:
resetin interfacePoolingConnectionFactoryMBean- Throws:
Exception
-