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 <ehugonne@redhat.com>
This commit is contained in:
parent
495350a0c1
commit
1d88b293c3
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue