Clear synchronization before triggering afterCompletion callbacks

Issue: SPR-15194
Issue: SPR-11590
This commit is contained in:
Juergen Hoeller
2017-02-10 10:39:33 +01:00
parent 5015613934
commit b630c9bea7
3 changed files with 69 additions and 13 deletions

View File

@@ -934,6 +934,7 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
private void triggerAfterCompletion(DefaultTransactionStatus status, int completionStatus) {
if (status.isNewSynchronization()) {
List<TransactionSynchronization> synchronizations = TransactionSynchronizationManager.getSynchronizations();
TransactionSynchronizationManager.clearSynchronization();
if (!status.hasTransaction() || status.isNewTransaction()) {
if (status.isDebug()) {
logger.trace("Triggering afterCompletion synchronization");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@@ -461,11 +461,11 @@ public abstract class TransactionSynchronizationManager {
* @see #setActualTransactionActive
*/
public static void clear() {
clearSynchronization();
setCurrentTransactionName(null);
setCurrentTransactionReadOnly(false);
setCurrentTransactionIsolationLevel(null);
setActualTransactionActive(false);
synchronizations.remove();
currentTransactionName.remove();
currentTransactionReadOnly.remove();;
currentTransactionIsolationLevel.remove();;
actualTransactionActive.remove();
}
}