Skip to content

Commit b8d72bd

Browse files
committed
Fix #4561 (revert #4430)
1 parent fe8ce08 commit b8d72bd

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

release-notes/VERSION-2.x

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ Project: jackson-databind
88

99
-
1010

11+
2.17.2 (not yet released)
12+
13+
#4561: Issues using jackson-databind 2.17.1 with Reactor
14+
(reported by @wdallastella)
15+
1116
2.17.1 (04-May-2024)
1217

1318
#4428: `ByteBuddy` scope went beyond `test` in version 2.17.0

src/main/java/com/fasterxml/jackson/databind/deser/DeserializerCache.java

+4-15
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.fasterxml.jackson.databind.deser;
22

33
import java.util.HashMap;
4-
import java.util.concurrent.locks.ReentrantLock;
54

65
import com.fasterxml.jackson.annotation.JsonFormat;
76
import com.fasterxml.jackson.databind.*;
@@ -53,12 +52,6 @@ public final class DeserializerCache
5352
protected final HashMap<JavaType, JsonDeserializer<Object>> _incompleteDeserializers
5453
= new HashMap<JavaType, JsonDeserializer<Object>>(8);
5554

56-
57-
/**
58-
* We hold an explicit lock while creating deserializers to avoid creating duplicates.
59-
*/
60-
private final ReentrantLock _incompleteDeserializersLock = new ReentrantLock();
61-
6255
/*
6356
/**********************************************************
6457
/* Life-cycle
@@ -249,12 +242,10 @@ protected JsonDeserializer<Object> _createAndCacheValueDeserializer(Deserializat
249242
DeserializerFactory factory, JavaType type)
250243
throws JsonMappingException
251244
{
252-
/* Only one thread to construct deserializers at any given point in time;
253-
* limitations necessary to ensure that only completely initialized ones
254-
* are visible and used.
255-
*/
256-
_incompleteDeserializersLock.lock();
257-
try {
245+
// Only one thread to construct deserializers at any given point in time;
246+
// limitations necessary to ensure that only completely initialized ones
247+
// are visible and used.
248+
synchronized (_incompleteDeserializers) {
258249
// Ok, then: could it be that due to a race condition, deserializer can now be found?
259250
JsonDeserializer<Object> deser = _findCachedDeserializer(type);
260251
if (deser != null) {
@@ -277,8 +268,6 @@ protected JsonDeserializer<Object> _createAndCacheValueDeserializer(Deserializat
277268
_incompleteDeserializers.clear();
278269
}
279270
}
280-
} finally {
281-
_incompleteDeserializersLock.unlock();
282271
}
283272
}
284273

0 commit comments

Comments
 (0)