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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAbstract builder forAbstractJmsConnectionProvidersubclasses. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final CachingStrategyprotected final Stringprotected final Supplier<jakarta.jms.ConnectionFactory>protected final GenericConnectionParametersprotected final AtomicBooleanUsed to ignore handling of ExceptionListener#onException when in the process of disconnectingprotected CompositeJmsExceptionListenerprotected booleanprotected final booleanprotected final booleanprotected jakarta.jms.ConnectionFactoryprotected final JmsSessionManagerprotected JmsSupportprotected final JmsSupportFactoryprotected ExceptionStores the last validation exception for subclass handling after doValidate returns null.protected static final org.slf4j.Loggerprotected JmsReconnectionManagerprotected Runnableprotected final JmsSpecificationprotected static final Stringprotected static final intprotected final XaPoolParametersFields inherited from interface org.mule.runtime.api.lifecycle.Disposable
PHASE_NAMEFields inherited from interface org.mule.runtime.api.lifecycle.Initialisable
PHASE_NAME -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedProtected constructor that uses the Builder to initialize all fields. -
Method Summary
Modifier and TypeMethodDescriptionprotected jakarta.jms.Connectionprotected voidA jmsConnectionFactory method to create various JmsSupport class versions.voiddispose()protected voiddoClose(JmsConnection jmsConnection) protected voiddoDisconnect(JmsTransactionalConnection jmsConnection) Common disconnect logic for both XA and non-XA providers.protected voiddoStop(JmsConnection jmsConnection) protected org.mule.sdk.api.connectivity.ConnectionValidationResultdoValidate(JmsTransactionalConnection jmsConnection, String connectionType) Performs basic connection validation and stores exception for subclass handling.jakarta.jms.ConnectionFactoryTemplate method for obtaining theConnectionFactoryto be used for creating theJmsConnectionsprotected voidhandleConnectionError(jakarta.jms.Connection connection, String connectionType) Handles connection errors during connect() by closing the connection and stopping the factory.protected org.mule.sdk.api.connectivity.ConnectionValidationResultvalidateWithTimeout(JmsTransactionalConnection jmsConnection) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.mule.runtime.api.lifecycle.Initialisable
initialise
-
Field Details
-
VALIDATION_TIMEOUT
protected static final int VALIDATION_TIMEOUT- See Also:
-
VALIDATION_THREAD_NAME_PATTERN
- See Also:
-
LOGGER
protected static final org.slf4j.Logger LOGGER -
jmsSessionManager
-
specification
-
connectionParameters
-
xaPoolParameters
-
cachingStrategy
-
isIBM
protected final boolean isIBM -
connectionFactorySupplier
-
isXa
protected final boolean isXa -
jmsSupportFactory
-
configName
-
reconnectionManager
-
exceptionListener
-
disconnecting
Used to ignore handling of ExceptionListener#onException when in the process of disconnecting -
jmsSupport
-
jmsConnectionFactory
protected jakarta.jms.ConnectionFactory jmsConnectionFactory -
isCacheEnabled
protected boolean isCacheEnabled -
setupSsl
-
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 theConnectionFactoryto be used for creating theJmsConnections- Returns:
- an instance of
ConnectionFactoryto be used for creating theJmsConnections
-
doStop
-
doClose
-
doDisconnect
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 validateconnectionType- the type of connection for error messages- Returns:
- validation result, or null if exception occurred and subclass should handle
-
handleConnectionError
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:
disposein interfaceorg.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 -
getConnectionParameters
-
getJmsSupport
-
getSpecification
-