File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
src/main/java/org/apache/ibatis/cache/decorators Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -72,9 +72,11 @@ public Object getObject(Object key) {
72
72
if (result == null ) {
73
73
delegate .removeObject (key );
74
74
} else {
75
- hardLinksToAvoidGarbageCollection .addFirst (result );
76
- if (hardLinksToAvoidGarbageCollection .size () > numberOfHardLinks ) {
77
- hardLinksToAvoidGarbageCollection .removeLast ();
75
+ synchronized (hardLinksToAvoidGarbageCollection ) {
76
+ hardLinksToAvoidGarbageCollection .addFirst (result );
77
+ if (hardLinksToAvoidGarbageCollection .size () > numberOfHardLinks ) {
78
+ hardLinksToAvoidGarbageCollection .removeLast ();
79
+ }
78
80
}
79
81
}
80
82
}
@@ -89,7 +91,9 @@ public Object removeObject(Object key) {
89
91
90
92
@ Override
91
93
public void clear () {
92
- hardLinksToAvoidGarbageCollection .clear ();
94
+ synchronized (hardLinksToAvoidGarbageCollection ) {
95
+ hardLinksToAvoidGarbageCollection .clear ();
96
+ }
93
97
removeGarbageCollectedItems ();
94
98
delegate .clear ();
95
99
}
You can’t perform that action at this time.
0 commit comments