Package org.messaginghub.pooled.jms
Class JmsPoolXAConnectionFactory
- java.lang.Object
-
- org.messaginghub.pooled.jms.JmsPoolConnectionFactory
-
- org.messaginghub.pooled.jms.JmsPoolXAConnectionFactory
-
- All Implemented Interfaces:
Serializable,javax.jms.ConnectionFactory,javax.jms.QueueConnectionFactory,javax.jms.TopicConnectionFactory,javax.jms.XAConnectionFactory,ObjectFactory
- Direct Known Subclasses:
JmsPoolJcaConnectionFactory
public class JmsPoolXAConnectionFactory extends JmsPoolConnectionFactory implements ObjectFactory, Serializable, javax.jms.XAConnectionFactory
A pooled connection factory that automatically enlists sessions in the current active XA transaction if any.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.messaginghub.pooled.jms.JmsPoolConnectionFactory
connectionFactory, DEFAULT_MAX_CONNECTIONS, jmsContextSupported, stopped
-
-
Constructor Summary
Constructors Constructor Description JmsPoolXAConnectionFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected PooledXAConnectioncreatePooledConnection(javax.jms.Connection connection)Delegate that creates each instance of an ConnectionPool object.protected javax.jms.XAConnectioncreateProviderConnection(PooledConnectionKey key)Given aPooledConnectionKeycreate a JMSConnectionusing the configuration from the key and the assigned JMSConnectionFactoryinstance.protected javax.jms.XAJMSContextcreateProviderContext(String username, String password, int sessionMode)Create a newJMSContextusing the provided credentials and Session modejavax.jms.XAConnectioncreateXAConnection()javax.jms.XAConnectioncreateXAConnection(String userName, String password)javax.jms.XAJMSContextcreateXAContext()javax.jms.XAJMSContextcreateXAContext(String userName, String password)ObjectgetObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment)StringgetTmJndiName()TransactionManagergetTransactionManager()booleanisTmFromJndi()protected JmsPoolXAJMSContextnewPooledConnectionContext(JmsPoolConnection connection, int sessionMode)Allows subclasses to create an appropriate JmsPoolJMSContext wrapper for the newly create JMSContext such as one that provides support for XA Transactions.voidsetConnectionFactory(Object toUse)Sets the ConnectionFactory used to create new pooled Connections.voidsetTmFromJndi(boolean tmFromJndi)Allow transaction manager resolution from JNDI (ee deployment)voidsetTmJndiName(String tmJndiName)voidsetTransactionManager(TransactionManager transactionManager)-
Methods inherited from class org.messaginghub.pooled.jms.JmsPoolConnectionFactory
clear, createConnection, createConnection, createContext, createContext, createContext, createContext, createQueueConnection, createQueueConnection, createTopicConnection, createTopicConnection, getBlockIfSessionPoolIsFullTimeout, getConnectionCheckInterval, getConnectionFactory, getConnectionIdleTimeout, getConnectionsPool, getExplicitProducerCacheSize, getMaxConnections, getMaxSessionsPerConnection, getNumConnections, initConnectionsPool, isBlockIfSessionPoolIsFull, isUseAnonymousProducers, isUseProviderJMSContext, newPooledConnectionWrapper, populateProperties, setBlockIfSessionPoolIsFull, setBlockIfSessionPoolIsFullTimeout, setConnectionCheckInterval, setConnectionIdleTimeout, setExplicitProducerCacheSize, setMaxConnections, setMaxSessionsPerConnection, setUseAnonymousProducers, setUseProviderJMSContext, start, stop
-
-
-
-
Method Detail
-
getTransactionManager
public TransactionManager getTransactionManager()
-
setTransactionManager
public void setTransactionManager(TransactionManager transactionManager)
-
setConnectionFactory
public void setConnectionFactory(Object toUse)
Description copied from class:JmsPoolConnectionFactorySets the ConnectionFactory used to create new pooled Connections.Updates to this value do not affect Connections that were previously created and placed into the pool. In order to allocate new Connections based off this new ConnectionFactory it is first necessary to
JmsPoolConnectionFactory.clear()the pooled Connections.- Overrides:
setConnectionFactoryin classJmsPoolConnectionFactory- Parameters:
toUse- The factory to use to create pooled Connections.
-
createProviderConnection
protected javax.jms.XAConnection createProviderConnection(PooledConnectionKey key) throws javax.jms.JMSException
Description copied from class:JmsPoolConnectionFactoryGiven aPooledConnectionKeycreate a JMSConnectionusing the configuration from the key and the assigned JMSConnectionFactoryinstance.- Overrides:
createProviderConnectionin classJmsPoolConnectionFactory- Parameters:
key- ThePooledSessionKeyto use as configuration for the new JMS Connection.- Returns:
- a new JMS Connection created using the configured JMS ConnectionFactory.
- Throws:
javax.jms.JMSException- if an error occurs while creating the new JMS Connection.
-
createProviderContext
protected javax.jms.XAJMSContext createProviderContext(String username, String password, int sessionMode)
Description copied from class:JmsPoolConnectionFactoryCreate a newJMSContextusing the provided credentials and Session mode- Overrides:
createProviderContextin classJmsPoolConnectionFactory- Parameters:
username- The user name to use when creating the context.password- The password to use when creating the context.sessionMode- The session mode to use when creating the context.- Returns:
- a new JMSContext created using the given configuration data..
-
createPooledConnection
protected PooledXAConnection createPooledConnection(javax.jms.Connection connection)
Description copied from class:JmsPoolConnectionFactoryDelegate that creates each instance of an ConnectionPool object. Subclasses can override this method to customize the type of connection pool returned.- Overrides:
createPooledConnectionin classJmsPoolConnectionFactory- Parameters:
connection- The connection that is being added into the pool.- Returns:
- instance of a new ConnectionPool.
-
newPooledConnectionContext
protected JmsPoolXAJMSContext newPooledConnectionContext(JmsPoolConnection connection, int sessionMode)
Description copied from class:JmsPoolConnectionFactoryAllows subclasses to create an appropriate JmsPoolJMSContext wrapper for the newly create JMSContext such as one that provides support for XA Transactions.- Overrides:
newPooledConnectionContextin classJmsPoolConnectionFactory- Parameters:
connection- TheJmsPoolConnectionto use in the JMSContext wrapper.sessionMode- The JMS Session acknowledgement mode to use in theJMSContext- Returns:
- a new
JmsPoolJMSContextthat wraps the givenJmsPoolConnection
-
getObjectInstance
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment) throws Exception
- Specified by:
getObjectInstancein interfaceObjectFactory- Throws:
Exception
-
getTmJndiName
public String getTmJndiName()
-
setTmJndiName
public void setTmJndiName(String tmJndiName)
-
isTmFromJndi
public boolean isTmFromJndi()
-
setTmFromJndi
public void setTmFromJndi(boolean tmFromJndi)
Allow transaction manager resolution from JNDI (ee deployment)- Parameters:
tmFromJndi- controls if TXN manager resolution is from JNDI
-
createXAConnection
public javax.jms.XAConnection createXAConnection() throws javax.jms.JMSException- Specified by:
createXAConnectionin interfacejavax.jms.XAConnectionFactory- Throws:
javax.jms.JMSException
-
createXAConnection
public javax.jms.XAConnection createXAConnection(String userName, String password) throws javax.jms.JMSException
- Specified by:
createXAConnectionin interfacejavax.jms.XAConnectionFactory- Throws:
javax.jms.JMSException
-
createXAContext
public javax.jms.XAJMSContext createXAContext()
- Specified by:
createXAContextin interfacejavax.jms.XAConnectionFactory
-
-