diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/DeserializerCache.java b/src/main/java/com/fasterxml/jackson/databind/deser/DeserializerCache.java index 0282af7213..d3591af73d 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/DeserializerCache.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/DeserializerCache.java @@ -56,6 +56,9 @@ public final class DeserializerCache /** * We hold an explicit lock while creating deserializers to avoid creating duplicates. + * Guards {@link #_incompleteDeserializers}. + * + * @since 2.17 */ private final ReentrantLock _incompleteDeserializersLock = new ReentrantLock(); @@ -169,10 +172,9 @@ public JsonDeserializer findValueDeserializer(DeserializationContext ctx // If not, need to request factory to construct (or recycle) deser = _createAndCacheValueDeserializer(ctxt, factory, propertyType); if (deser == null) { - /* Should we let caller handle it? Let's have a helper method - * decide it; can throw an exception, or return a valid - * deserializer - */ + // Should we let caller handle it? Let's have a helper method + // decide it; can throw an exception, or return a valid + // deserializer deser = _handleUnknownValueDeserializer(ctxt, propertyType); } } @@ -211,9 +213,8 @@ public boolean hasValueDeserializerFor(DeserializationContext ctxt, DeserializerFactory factory, JavaType type) throws JsonMappingException { - /* Note: mostly copied from findValueDeserializer, except for - * handling of unknown types - */ + // Note: mostly copied from findValueDeserializer, except for + // handling of unknown types JsonDeserializer deser = _findCachedDeserializer(type); if (deser == null) { deser = _createAndCacheValueDeserializer(ctxt, factory, type); @@ -249,10 +250,9 @@ protected JsonDeserializer _createAndCacheValueDeserializer(Deserializat DeserializerFactory factory, JavaType type) throws JsonMappingException { - /* Only one thread to construct deserializers at any given point in time; - * limitations necessary to ensure that only completely initialized ones - * are visible and used. - */ + // Only one thread to construct deserializers at any given point in time; + // limitations necessary to ensure that only completely initialized ones + // are visible and used. _incompleteDeserializersLock.lock(); try { // Ok, then: could it be that due to a race condition, deserializer can now be found?