1
1
/*
2
- * Copyright 2002-2019 the original author or authors.
2
+ * Copyright 2002-2021 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
23
23
import java .util .Map ;
24
24
import java .util .Set ;
25
25
26
- import org .apache .commons .logging .Log ;
27
- import org .apache .commons .logging .LogFactory ;
28
26
import reactor .core .publisher .Mono ;
29
27
30
28
import org .springframework .core .annotation .AnnotationAwareOrderComparator ;
71
69
*/
72
70
public class TransactionSynchronizationManager {
73
71
74
- private static final Log logger = LogFactory .getLog (TransactionSynchronizationManager .class );
75
-
76
72
private final TransactionContext transactionContext ;
77
73
78
74
@@ -112,12 +108,7 @@ public boolean hasResource(Object key) {
112
108
@ Nullable
113
109
public Object getResource (Object key ) {
114
110
Object actualKey = TransactionSynchronizationUtils .unwrapResourceIfNecessary (key );
115
- Object value = doGetResource (actualKey );
116
- if (value != null && logger .isTraceEnabled ()) {
117
- logger .trace ("Retrieved value [" + value + "] for key [" + actualKey + "] bound to context [" +
118
- this .transactionContext .getName () + "]" );
119
- }
120
- return value ;
111
+ return doGetResource (actualKey );
121
112
}
122
113
123
114
/**
@@ -140,12 +131,8 @@ public void bindResource(Object key, Object value) throws IllegalStateException
140
131
Map <Object , Object > map = this .transactionContext .getResources ();
141
132
Object oldValue = map .put (actualKey , value );
142
133
if (oldValue != null ) {
143
- throw new IllegalStateException ("Already value [" + oldValue + "] for key [" +
144
- actualKey + "] bound to context [" + this .transactionContext .getName () + "]" );
145
- }
146
- if (logger .isTraceEnabled ()) {
147
- logger .trace ("Bound value [" + value + "] for key [" + actualKey + "] to context [" +
148
- this .transactionContext .getName () + "]" );
134
+ throw new IllegalStateException (
135
+ "Already value [" + oldValue + "] for key [" + actualKey + "] bound to context" );
149
136
}
150
137
}
151
138
@@ -159,8 +146,7 @@ public Object unbindResource(Object key) throws IllegalStateException {
159
146
Object actualKey = TransactionSynchronizationUtils .unwrapResourceIfNecessary (key );
160
147
Object value = doUnbindResource (actualKey );
161
148
if (value == null ) {
162
- throw new IllegalStateException (
163
- "No value for key [" + actualKey + "] bound to context [" + this .transactionContext .getName () + "]" );
149
+ throw new IllegalStateException ("No value for key [" + actualKey + "] bound to context" );
164
150
}
165
151
return value ;
166
152
}
@@ -182,12 +168,7 @@ public Object unbindResourceIfPossible(Object key) {
182
168
@ Nullable
183
169
private Object doUnbindResource (Object actualKey ) {
184
170
Map <Object , Object > map = this .transactionContext .getResources ();
185
- Object value = map .remove (actualKey );
186
- if (value != null && logger .isTraceEnabled ()) {
187
- logger .trace ("Removed value [" + value + "] for key [" + actualKey + "] from context [" +
188
- this .transactionContext .getName () + "]" );
189
- }
190
- return value ;
171
+ return map .remove (actualKey );
191
172
}
192
173
193
174
@@ -213,7 +194,6 @@ public void initSynchronization() throws IllegalStateException {
213
194
if (isSynchronizationActive ()) {
214
195
throw new IllegalStateException ("Cannot activate transaction synchronization - already active" );
215
196
}
216
- logger .trace ("Initializing transaction synchronization" );
217
197
this .transactionContext .setSynchronizations (new LinkedHashSet <>());
218
198
}
219
199
@@ -273,7 +253,6 @@ public void clearSynchronization() throws IllegalStateException {
273
253
if (!isSynchronizationActive ()) {
274
254
throw new IllegalStateException ("Cannot deactivate transaction synchronization - not active" );
275
255
}
276
- logger .trace ("Clearing transaction synchronization" );
277
256
this .transactionContext .setSynchronizations (null );
278
257
}
279
258
0 commit comments