This is an automated email from the ASF dual-hosted git repository.

mattsicker pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit 462baebc18960ad754fc0d254973cdd1da0e0820
Author: Matt Sicker <[email protected]>
AuthorDate: Thu Feb 3 20:53:58 2022 -0600

    Use correct instance lock
    
    Signed-off-by: Matt Sicker <[email protected]>
---
 .../apache/logging/log4j/plugins/convert/TypeConverterRegistry.java  | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git 
a/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/convert/TypeConverterRegistry.java
 
b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/convert/TypeConverterRegistry.java
index d246727..17e3583 100644
--- 
a/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/convert/TypeConverterRegistry.java
+++ 
b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/convert/TypeConverterRegistry.java
@@ -43,7 +43,6 @@ public class TypeConverterRegistry {
 
     private static final Logger LOGGER = StatusLogger.getLogger();
     private static final Value<TypeConverterRegistry> INSTANCE = 
LazyValue.forSupplier(TypeConverterRegistry::new);
-    private static final Object INSTANCE_LOCK = new Object();
 
     private final ConcurrentMap<Type, TypeConverter<?>> registry = new 
ConcurrentHashMap<>();
 
@@ -79,7 +78,7 @@ public class TypeConverterRegistry {
             if (clazz.isEnum()) {
                 @SuppressWarnings({"unchecked","rawtypes"})
                 final EnumConverter<? extends Enum> converter = new 
EnumConverter(clazz.asSubclass(Enum.class));
-                synchronized (INSTANCE_LOCK) {
+                synchronized (INSTANCE) {
                     return registerConverter(type, converter);
                 }
             }
@@ -90,7 +89,7 @@ public class TypeConverterRegistry {
             if (TypeUtil.isAssignable(type, key)) {
                 LOGGER.debug("Found compatible TypeConverter<{}> for type 
[{}].", key, type);
                 final TypeConverter<?> value = entry.getValue();
-                synchronized (INSTANCE_LOCK) {
+                synchronized (INSTANCE) {
                     return registerConverter(type, value);
                 }
             }

Reply via email to