Class JmsPoolXAConnectionFactory

java.lang.Object
org.messaginghub.pooled.jms.JmsPoolConnectionFactory
org.messaginghub.pooled.jms.JmsPoolXAConnectionFactory
All Implemented Interfaces:
jakarta.jms.ConnectionFactory, jakarta.jms.QueueConnectionFactory, jakarta.jms.TopicConnectionFactory, jakarta.jms.XAConnectionFactory, Serializable, ObjectFactory
Direct Known Subclasses:
JmsPoolJcaConnectionFactory

public class JmsPoolXAConnectionFactory extends JmsPoolConnectionFactory implements ObjectFactory, Serializable, jakarta.jms.XAConnectionFactory
A pooled connection factory that automatically enlists sessions in the current active XA transaction if any.
See Also:
  • Constructor Details

    • JmsPoolXAConnectionFactory

      public JmsPoolXAConnectionFactory()
  • Method Details

    • getTransactionManager

      public jakarta.transaction.TransactionManager getTransactionManager()
    • setTransactionManager

      public void setTransactionManager(jakarta.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 class JmsPoolConnectionFactory
      Parameters:
      toUse - The factory to use to create pooled Connections.
    • createProviderConnection

      protected jakarta.jms.XAConnection createProviderConnection(PooledConnectionKey key) throws jakarta.jms.JMSException
      Description copied from class: JmsPoolConnectionFactory
      Given a PooledConnectionKey create a JMS Connection using the configuration from the key and the assigned JMS ConnectionFactory instance.
      Overrides:
      createProviderConnection in class JmsPoolConnectionFactory
      Parameters:
      key - The PooledSessionKey to use as configuration for the new JMS Connection.
      Returns:
      a new JMS Connection created using the configured JMS ConnectionFactory.
      Throws:
      jakarta.jms.JMSException - if an error occurs while creating the new JMS Connection.
    • createProviderContext

      protected jakarta.jms.XAJMSContext createProviderContext(String username, String password, int sessionMode)
      Description copied from class: JmsPoolConnectionFactory
      Create a new JMSContext using the provided credentials and Session mode
      Overrides:
      createProviderContext in class JmsPoolConnectionFactory
      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(jakarta.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 class JmsPoolConnectionFactory
      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 class JmsPoolConnectionFactory
      Parameters:
      connection - The JmsPoolConnection to use in the JMSContext wrapper.
      sessionMode - The JMS Session acknowledgement mode to use in the JMSContext
      Returns:
      a new JmsPoolJMSContext that wraps the given JmsPoolConnection
    • getObjectInstance

      public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment) throws Exception
      Specified by:
      getObjectInstance in interface ObjectFactory
      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 jakarta.jms.XAConnection createXAConnection() throws jakarta.jms.JMSException
      Specified by:
      createXAConnection in interface jakarta.jms.XAConnectionFactory
      Throws:
      jakarta.jms.JMSException
    • createXAConnection

      public jakarta.jms.XAConnection createXAConnection(String userName, String password) throws jakarta.jms.JMSException
      Specified by:
      createXAConnection in interface jakarta.jms.XAConnectionFactory
      Throws:
      jakarta.jms.JMSException
    • createXAContext

      public jakarta.jms.XAJMSContext createXAContext()
      Specified by:
      createXAContext in interface jakarta.jms.XAConnectionFactory
    • createXAContext

      public jakarta.jms.XAJMSContext createXAContext(String userName, String password)
      Specified by:
      createXAContext in interface jakarta.jms.XAConnectionFactory