18
18
19
19
import java .lang .reflect .Method ;
20
20
import java .util .Properties ;
21
- import java .util .concurrent .ConcurrentHashMap ;
22
21
import java .util .concurrent .ConcurrentMap ;
23
22
24
23
import org .apache .commons .logging .Log ;
35
34
import org .springframework .transaction .TransactionSystemException ;
36
35
import org .springframework .transaction .support .CallbackPreferringPlatformTransactionManager ;
37
36
import org .springframework .transaction .support .TransactionCallback ;
37
+ import org .springframework .util .ConcurrentReferenceHashMap ;
38
38
import org .springframework .util .StringUtils ;
39
39
40
40
/**
68
68
*/
69
69
public abstract class TransactionAspectSupport implements BeanFactoryAware , InitializingBean {
70
70
71
+ // NOTE: This class must not implement Serializable because it serves as base
72
+ // class for AspectJ aspects (which are not allowed to implement Serializable)!
73
+
74
+
71
75
/**
72
76
* Key to use to store the default transaction manager.
73
77
*/
74
- private final Object DEFAULT_TRANSACTION_MANAGER_KEY = new Object ();
75
-
76
- // NOTE: This class must not implement Serializable because it serves as base
77
- // class for AspectJ aspects (which are not allowed to implement Serializable)!
78
+ private static final Object DEFAULT_TRANSACTION_MANAGER_KEY = new Object ();
78
79
79
80
/**
80
81
* Holder to support the {@code currentTransactionStatus()} method,
@@ -86,9 +87,6 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
86
87
new NamedThreadLocal <>("Current aspect-driven transaction" );
87
88
88
89
89
- private final ConcurrentMap <Object , PlatformTransactionManager > transactionManagerCache =
90
- new ConcurrentHashMap <>();
91
-
92
90
/**
93
91
* Subclasses can use this to return the current TransactionInfo.
94
92
* Only subclasses that cannot handle all operations in one method,
@@ -128,15 +126,15 @@ public static TransactionStatus currentTransactionStatus() throws NoTransactionE
128
126
129
127
protected final Log logger = LogFactory .getLog (getClass ());
130
128
131
- /**
132
- * Default transaction manager bean name.
133
- */
134
129
private String transactionManagerBeanName ;
135
130
136
131
private TransactionAttributeSource transactionAttributeSource ;
137
132
138
133
private BeanFactory beanFactory ;
139
134
135
+ private final ConcurrentMap <Object , PlatformTransactionManager > transactionManagerCache =
136
+ new ConcurrentReferenceHashMap <>(4 );
137
+
140
138
141
139
/**
142
140
* Specify the name of the default transaction manager bean.
0 commit comments