AbstractMessageListenerContainer calls "Session.recover()" in case of rollback attempt on non-transacted Session
Issue: SPR-12015
(cherry picked from commit c082220)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -588,9 +588,14 @@ public abstract class AbstractMessageListenerContainer extends AbstractJmsListen
|
||||
* @throws javax.jms.JMSException in case of a rollback error
|
||||
*/
|
||||
protected void rollbackIfNecessary(Session session) throws JMSException {
|
||||
if (session.getTransacted() && isSessionLocallyTransacted(session)) {
|
||||
// Transacted session created by this container -> rollback.
|
||||
JmsUtils.rollbackIfNecessary(session);
|
||||
if (session.getTransacted()) {
|
||||
if (isSessionLocallyTransacted(session)) {
|
||||
// Transacted session created by this container -> rollback.
|
||||
JmsUtils.rollbackIfNecessary(session);
|
||||
}
|
||||
}
|
||||
else {
|
||||
session.recover();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -602,12 +607,17 @@ public abstract class AbstractMessageListenerContainer extends AbstractJmsListen
|
||||
*/
|
||||
protected void rollbackOnExceptionIfNecessary(Session session, Throwable ex) throws JMSException {
|
||||
try {
|
||||
if (session.getTransacted() && isSessionLocallyTransacted(session)) {
|
||||
// Transacted session created by this container -> rollback.
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Initiating transaction rollback on application exception", ex);
|
||||
if (session.getTransacted()) {
|
||||
if (isSessionLocallyTransacted(session)) {
|
||||
// Transacted session created by this container -> rollback.
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Initiating transaction rollback on application exception", ex);
|
||||
}
|
||||
JmsUtils.rollbackIfNecessary(session);
|
||||
}
|
||||
JmsUtils.rollbackIfNecessary(session);
|
||||
}
|
||||
else {
|
||||
session.recover();
|
||||
}
|
||||
}
|
||||
catch (IllegalStateException ex2) {
|
||||
|
||||
Reference in New Issue
Block a user