Class AbstractJmsConnectionProvider

java.lang.Object
org.mule.jms.commons.internal.connection.provider.AbstractJmsConnectionProvider
All Implemented Interfaces:
org.mule.runtime.api.lifecycle.Disposable, org.mule.runtime.api.lifecycle.Initialisable
Direct Known Subclasses:
JmsNonXaConnectionProvider, JmsXaConnectionProvider

public abstract class AbstractJmsConnectionProvider extends Object implements org.mule.runtime.api.lifecycle.Initialisable, org.mule.runtime.api.lifecycle.Disposable
Base implementation of a PoolingConnectionProvider for JmsConnections
Since:
1.0
  • Field Details

    • VALIDATION_TIMEOUT

      protected static final int VALIDATION_TIMEOUT
      See Also:
    • VALIDATION_THREAD_NAME_PATTERN

      protected static final String VALIDATION_THREAD_NAME_PATTERN
      See Also:
    • LOGGER

      protected static final org.slf4j.Logger LOGGER
    • jmsSessionManager

      protected final JmsSessionManager jmsSessionManager
    • specification

      protected final JmsSpecification specification
    • connectionParameters

      protected final GenericConnectionParameters connectionParameters
    • xaPoolParameters

      protected final XaPoolParameters xaPoolParameters
    • cachingStrategy

      protected final CachingStrategy cachingStrategy
    • isIBM

      protected final boolean isIBM
    • connectionFactorySupplier

      protected final Supplier<jakarta.jms.ConnectionFactory> connectionFactorySupplier
    • isXa

      protected final boolean isXa
    • jmsSupportFactory

      protected final JmsSupportFactory jmsSupportFactory
    • configName

      protected final String configName
    • reconnectionManager

      protected JmsReconnectionManager reconnectionManager
    • exceptionListener

      protected CompositeJmsExceptionListener exceptionListener
    • disconnecting

      protected final AtomicBoolean disconnecting
      Used to ignore handling of ExceptionListener#onException when in the process of disconnecting
    • jmsSupport

      protected JmsSupport jmsSupport
    • jmsConnectionFactory

      protected jakarta.jms.ConnectionFactory jmsConnectionFactory
    • isCacheEnabled

      protected boolean isCacheEnabled
    • setupSsl

      protected Runnable setupSsl
    • lastValidationException

      protected Exception lastValidationException
      Stores the last validation exception for subclass handling after doValidate returns null.
  • Constructor Details

    • AbstractJmsConnectionProvider

      protected AbstractJmsConnectionProvider(AbstractJmsConnectionProvider.Builder<?> builder) throws org.mule.runtime.api.lifecycle.InitialisationException
      Protected constructor that uses the Builder to initialize all fields.
      Parameters:
      builder - the builder containing all configuration parameters
      Throws:
      org.mule.runtime.api.lifecycle.InitialisationException - if initialization fails
  • Method Details

    • getConnectionFactory

      public jakarta.jms.ConnectionFactory getConnectionFactory()
      Template method for obtaining the ConnectionFactory to be used for creating the JmsConnections
      Returns:
      an instance of ConnectionFactory to be used for creating the JmsConnections
    • doStop

      protected void doStop(JmsConnection jmsConnection)
    • doClose

      protected void doClose(JmsConnection jmsConnection)
    • doDisconnect

      protected void doDisconnect(JmsTransactionalConnection jmsConnection)
      Common disconnect logic for both XA and non-XA providers.
      Parameters:
      jmsConnection - the connection to disconnect
    • doValidate

      protected org.mule.sdk.api.connectivity.ConnectionValidationResult doValidate(JmsTransactionalConnection jmsConnection, String connectionType)
      Performs basic connection validation and stores exception for subclass handling.
      Parameters:
      jmsConnection - the connection to validate
      connectionType - the type of connection for error messages
      Returns:
      validation result, or null if exception occurred and subclass should handle
    • handleConnectionError

      protected void handleConnectionError(jakarta.jms.Connection connection, String connectionType)
      Handles connection errors during connect() by closing the connection and stopping the factory.
      Parameters:
      connection - the connection to close (may be null)
      connectionType - the type of connection for log messages
    • dispose

      public void dispose()
      Specified by:
      dispose in interface org.mule.runtime.api.lifecycle.Disposable
    • createJmsSupport

      protected void createJmsSupport()
      A jmsConnectionFactory method to create various JmsSupport class versions.
      See Also:
    • createConnection

      protected jakarta.jms.Connection createConnection() throws jakarta.jms.JMSException
      Throws:
      jakarta.jms.JMSException
    • validateWithTimeout

      protected org.mule.sdk.api.connectivity.ConnectionValidationResult validateWithTimeout(JmsTransactionalConnection jmsConnection) throws InterruptedException, ExecutionException
      Throws:
      InterruptedException
      ExecutionException
    • getConnectionParameters

      public GenericConnectionParameters getConnectionParameters()
    • getJmsSupport

      public JmsSupport getJmsSupport()
    • getSpecification

      public JmsSpecification getSpecification()