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 PooledXAConnection
createPooledConnection(javax.jms.Connection connection)
Delegate that creates each instance of an ConnectionPool object.protected javax.jms.XAConnection
createProviderConnection(PooledConnectionKey key)
Given aPooledConnectionKey
create a JMSConnection
using the configuration from the key and the assigned JMSConnectionFactory
instance.protected javax.jms.XAJMSContext
createProviderContext(String username, String password, int sessionMode)
Create a newJMSContext
using the provided credentials and Session modejavax.jms.XAConnection
createXAConnection()
javax.jms.XAConnection
createXAConnection(String userName, String password)
javax.jms.XAJMSContext
createXAContext()
javax.jms.XAJMSContext
createXAContext(String userName, String password)
Object
getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment)
String
getTmJndiName()
javax.transaction.TransactionManager
getTransactionManager()
boolean
isTmFromJndi()
protected JmsPoolXAJMSContext
newPooledConnectionContext(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.void
setConnectionFactory(Object toUse)
Sets the ConnectionFactory used to create new pooled Connections.void
setTmFromJndi(boolean tmFromJndi)
Allow transaction manager resolution from JNDI (ee deployment)void
setTmJndiName(String tmJndiName)
void
setTransactionManager(javax.transaction.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 javax.transaction.TransactionManager getTransactionManager()
-
setTransactionManager
public void setTransactionManager(javax.transaction.TransactionManager transactionManager)
-
setConnectionFactory
public void setConnectionFactory(Object toUse)
Description copied from class:JmsPoolConnectionFactory
Sets 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:
setConnectionFactory
in 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:JmsPoolConnectionFactory
Given aPooledConnectionKey
create a JMSConnection
using the configuration from the key and the assigned JMSConnectionFactory
instance.- Overrides:
createProviderConnection
in classJmsPoolConnectionFactory
- Parameters:
key
- ThePooledSessionKey
to 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:JmsPoolConnectionFactory
Create a newJMSContext
using the provided credentials and Session mode- Overrides:
createProviderContext
in 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:JmsPoolConnectionFactory
Delegate that creates each instance of an ConnectionPool object. Subclasses can override this method to customize the type of connection pool returned.- Overrides:
createPooledConnection
in 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:JmsPoolConnectionFactory
Allows subclasses to create an appropriate JmsPoolJMSContext wrapper for the newly create JMSContext such as one that provides support for XA Transactions.- Overrides:
newPooledConnectionContext
in classJmsPoolConnectionFactory
- Parameters:
connection
- TheJmsPoolConnection
to use in the JMSContext wrapper.sessionMode
- The JMS Session acknowledgement mode to use in theJMSContext
- Returns:
- a new
JmsPoolJMSContext
that wraps the givenJmsPoolConnection
-
getObjectInstance
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment) throws Exception
- Specified by:
getObjectInstance
in 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:
createXAConnection
in interfacejavax.jms.XAConnectionFactory
- Throws:
javax.jms.JMSException
-
createXAConnection
public javax.jms.XAConnection createXAConnection(String userName, String password) throws javax.jms.JMSException
- Specified by:
createXAConnection
in interfacejavax.jms.XAConnectionFactory
- Throws:
javax.jms.JMSException
-
createXAContext
public javax.jms.XAJMSContext createXAContext()
- Specified by:
createXAContext
in interfacejavax.jms.XAConnectionFactory
-
-