This is an automated email from the ASF dual-hosted git repository.
clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
The following commit(s) were added to refs/heads/main by this push:
new 1d88b293c3 ARTEMIS-4427 MDB reusing Thread is using wrong
transactionTimeout.
1d88b293c3 is described below
commit 1d88b293c37546493e9ef84bf9a9933f3658cf0e
Author: Emmanuel Hugonnet <[email protected]>
AuthorDate: Tue Sep 12 15:51:23 2023 +0200
ARTEMIS-4427 MDB reusing Thread is using wrong transactionTimeout.
* Unsetting the transation timeout on the TransactionManager after the
onMessage has been called
Issue: https://issues.apache.org/jira/browse/ARTEMIS-4427
Signed-off-by: Emmanuel Hugonnet <[email protected]>
---
.../activemq/artemis/ra/inflow/ActiveMQMessageHandler.java | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git
a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQMessageHandler.java
b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQMessageHandler.java
index 4fbb7f6ed5..8be00955ad 100644
---
a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQMessageHandler.java
+++
b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQMessageHandler.java
@@ -55,6 +55,7 @@ import org.apache.activemq.artemis.utils.VersionLoader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.invoke.MethodHandles;
+import javax.transaction.SystemException;
import javax.transaction.TransactionManager;
/**
@@ -288,7 +289,6 @@ public class ActiveMQMessageHandler implements
MessageHandler, FailoverEventList
@Override
public void onMessage(final ClientMessage message) {
logger.trace("onMessage({})", message);
-
ActiveMQMessage msg;
if (enable1XPrefix) {
msg = ActiveMQCompatibleMessage.createMessage(message, session,
options);
@@ -379,6 +379,15 @@ public class ActiveMQMessageHandler implements
MessageHandler, FailoverEventList
session.markRollbackOnly();
} finally {
try {
+ if (activation.getActivationSpec().getTransactionTimeout() > 0) {
+ TransactionManager tm = ServiceUtils.getTransactionManager();
+ if (tm != null) {
+ try {
+ tm.setTransactionTimeout(0);
+ } catch (SystemException ex) {
+ }
+ }
+ }
session.resetIfNeeded();
} catch (ActiveMQException e) {
ActiveMQRALogger.LOGGER.unableToResetSession(activation.toString(), e);