Skip to content

Commit 2a9ca66

Browse files
committed
Restored hard reference cache in TransactionAspectSupport for 4.2.8
Issue: SPR-14511 Issue: SPR-14609
1 parent 081c3ac commit 2a9ca66

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAspectSupport.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.lang.reflect.Method;
2020
import java.util.Properties;
21+
import java.util.concurrent.ConcurrentHashMap;
2122
import java.util.concurrent.ConcurrentMap;
2223

2324
import org.apache.commons.logging.Log;
@@ -34,7 +35,6 @@
3435
import org.springframework.transaction.TransactionSystemException;
3536
import org.springframework.transaction.support.CallbackPreferringPlatformTransactionManager;
3637
import org.springframework.transaction.support.TransactionCallback;
37-
import org.springframework.util.ConcurrentReferenceHashMap;
3838
import org.springframework.util.StringUtils;
3939

4040
/**
@@ -133,7 +133,7 @@ public static TransactionStatus currentTransactionStatus() throws NoTransactionE
133133
private BeanFactory beanFactory;
134134

135135
private final ConcurrentMap<Object, PlatformTransactionManager> transactionManagerCache =
136-
new ConcurrentReferenceHashMap<Object, PlatformTransactionManager>(4);
136+
new ConcurrentHashMap<Object, PlatformTransactionManager>(4);
137137

138138

139139
/**
@@ -242,9 +242,10 @@ protected final BeanFactory getBeanFactory() {
242242
public void afterPropertiesSet() {
243243
if (getTransactionManager() == null && this.beanFactory == null) {
244244
throw new IllegalStateException(
245-
"Setting the property 'transactionManager' or running in a BeanFactory is required");
245+
"Set the 'transactionManager' property or make sure to run within a BeanFactory " +
246+
"containing a PlatformTransactionManager bean!");
246247
}
247-
if (this.transactionAttributeSource == null) {
248+
if (getTransactionAttributeSource() == null) {
248249
throw new IllegalStateException(
249250
"Either 'transactionAttributeSource' or 'transactionAttributes' is required: " +
250251
"If there are no transactional methods, then don't use a transaction aspect.");
@@ -567,6 +568,7 @@ protected final class TransactionInfo {
567568

568569
public TransactionInfo(PlatformTransactionManager transactionManager,
569570
TransactionAttribute transactionAttribute, String joinpointIdentification) {
571+
570572
this.transactionManager = transactionManager;
571573
this.transactionAttribute = transactionAttribute;
572574
this.joinpointIdentification = joinpointIdentification;

0 commit comments

Comments
 (0)