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

pkarwasz pushed a commit to branch feature/move-thread-context
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit d8059f40b0466d93577b97aae30b1a194338de2d
Author: Piotr P. Karwasz <[email protected]>
AuthorDate: Mon Jun 24 08:40:04 2024 +0200

    Remove `CopyOnWriteSortedArrayThreadContextMap`
---
 .../logging/log4j/spi/ThreadContextMapTest.java    |  10 +-
 .../CopyOnWriteSortedArrayThreadContextMap.java    | 255 ---------------------
 .../logging/log4j/spi/DefaultThreadContextMap.java |   2 +-
 .../org/apache/logging/log4j/spi/Provider.java     |  12 +-
 .../async/AbstractAsyncThreadContextTestBase.java  |   3 +-
 .../async/AsyncThreadContextCopyOnWriteTest.java   |  40 ----
 .../core/impl/ThreadContextDataInjectorTest.java   |   1 -
 .../log4j/perf/jmh/ThreadContextBenchmark.java     |  10 +-
 .../jmh/ThreadContextVsScopedContextBenchmark.java |   9 +-
 .../CopyOnWriteOpenHashMapThreadContextMap.java    |  46 ----
 10 files changed, 9 insertions(+), 379 deletions(-)

diff --git 
a/log4j-api-test/src/test/java/org/apache/logging/log4j/spi/ThreadContextMapTest.java
 
b/log4j-api-test/src/test/java/org/apache/logging/log4j/spi/ThreadContextMapTest.java
index 04392d7d7a..2eb63dedf0 100644
--- 
a/log4j-api-test/src/test/java/org/apache/logging/log4j/spi/ThreadContextMapTest.java
+++ 
b/log4j-api-test/src/test/java/org/apache/logging/log4j/spi/ThreadContextMapTest.java
@@ -32,20 +32,14 @@ class ThreadContextMapTest {
     private static final String KEY = "key";
 
     static Stream<ThreadContextMap> defaultMaps() {
-        return Stream.of(
-                new DefaultThreadContextMap(),
-                new CopyOnWriteSortedArrayThreadContextMap(),
-                new GarbageFreeSortedArrayThreadContextMap());
+        return Stream.of(new DefaultThreadContextMap(), new 
GarbageFreeSortedArrayThreadContextMap());
     }
 
     static Stream<ThreadContextMap> inheritableMaps() {
         final Properties props = new Properties();
         props.setProperty("log4j2.isThreadContextMapInheritable", "true");
         final PropertiesUtil util = new PropertiesUtil(props);
-        return Stream.of(
-                new DefaultThreadContextMap(util),
-                new CopyOnWriteSortedArrayThreadContextMap(util),
-                new GarbageFreeSortedArrayThreadContextMap(util));
+        return Stream.of(new DefaultThreadContextMap(util), new 
GarbageFreeSortedArrayThreadContextMap(util));
     }
 
     @ParameterizedTest
diff --git 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteSortedArrayThreadContextMap.java
 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteSortedArrayThreadContextMap.java
deleted file mode 100644
index ca9f501c21..0000000000
--- 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteSortedArrayThreadContextMap.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.logging.log4j.spi;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-import org.apache.logging.log4j.util.PropertiesUtil;
-import org.apache.logging.log4j.util.ReadOnlyStringMap;
-import org.apache.logging.log4j.util.SortedArrayStringMap;
-import org.apache.logging.log4j.util.StringMap;
-
-/**
- * {@code SortedArrayStringMap}-based implementation of the {@code 
ThreadContextMap} interface that creates a copy of
- * the data structure on every modification. Any particular instance of the 
data structure is a snapshot of the
- * ThreadContext at some point in time and can safely be passed off to other 
threads.  Since it is
- * expected that the Map will be passed to many more log events than the 
number of keys it contains the performance
- * should be much better than if the Map was copied for each event.
- *
- * @since 2.7
- */
-class CopyOnWriteSortedArrayThreadContextMap implements 
ReadOnlyThreadContextMap, ObjectThreadContextMap, CopyOnWrite {
-
-    /**
-     * Property name ({@value} ) for selecting {@code InheritableThreadLocal} 
(value "true") or plain
-     * {@code ThreadLocal} (value is not "true") in the implementation.
-     */
-    public static final String INHERITABLE_MAP = 
"isThreadContextMapInheritable";
-
-    /**
-     * The default initial capacity.
-     */
-    protected static final int DEFAULT_INITIAL_CAPACITY = 16;
-
-    /**
-     * System property name that can be used to control the data structure's 
initial capacity.
-     */
-    protected static final String PROPERTY_NAME_INITIAL_CAPACITY = 
"log4j2.ThreadContext.initial.capacity";
-
-    private static final StringMap EMPTY_CONTEXT_DATA = new 
SortedArrayStringMap(1);
-
-    static {
-        EMPTY_CONTEXT_DATA.freeze();
-    }
-
-    private final int initialCapacity;
-    private final ThreadLocal<StringMap> localMap;
-
-    public CopyOnWriteSortedArrayThreadContextMap() {
-        this(PropertiesUtil.getProperties());
-    }
-
-    CopyOnWriteSortedArrayThreadContextMap(final PropertiesUtil properties) {
-        initialCapacity = 
properties.getIntegerProperty(PROPERTY_NAME_INITIAL_CAPACITY, 
DEFAULT_INITIAL_CAPACITY);
-        localMap = properties.getBooleanProperty(INHERITABLE_MAP)
-                ? new InheritableThreadLocal<StringMap>() {
-                    @Override
-                    protected StringMap childValue(final StringMap 
parentValue) {
-                        if (parentValue == null) {
-                            return null;
-                        }
-                        final StringMap stringMap = 
createStringMap(parentValue);
-                        stringMap.freeze();
-                        return stringMap;
-                    }
-                }
-                : new ThreadLocal<StringMap>();
-    }
-
-    /**
-     * Returns an implementation of the {@code StringMap} used to back this 
thread context map.
-     * <p>
-     * Subclasses may override.
-     * </p>
-     * @return an implementation of the {@code StringMap} used to back this 
thread context map
-     */
-    protected StringMap createStringMap() {
-        return new SortedArrayStringMap(initialCapacity);
-    }
-
-    /**
-     * Returns an implementation of the {@code StringMap} used to back this 
thread context map, pre-populated
-     * with the contents of the specified context data.
-     * <p>
-     * Subclasses may override.
-     * </p>
-     * @param original the key-value pairs to initialize the returned context 
data with
-     * @return an implementation of the {@code StringMap} used to back this 
thread context map
-     */
-    protected StringMap createStringMap(final ReadOnlyStringMap original) {
-        return new SortedArrayStringMap(original);
-    }
-
-    @Override
-    public void put(final String key, final String value) {
-        putValue(key, value);
-    }
-
-    @Override
-    public void putValue(final String key, final Object value) {
-        StringMap map = localMap.get();
-        map = map == null ? createStringMap() : createStringMap(map);
-        map.putValue(key, value);
-        map.freeze();
-        localMap.set(map);
-    }
-
-    @Override
-    public void putAll(final Map<String, String> values) {
-        if (values == null || values.isEmpty()) {
-            return;
-        }
-        StringMap map = localMap.get();
-        map = map == null ? createStringMap() : createStringMap(map);
-        for (final Map.Entry<String, String> entry : values.entrySet()) {
-            map.putValue(entry.getKey(), entry.getValue());
-        }
-        map.freeze();
-        localMap.set(map);
-    }
-
-    @Override
-    public <V> void putAllValues(final Map<String, V> values) {
-        if (values == null || values.isEmpty()) {
-            return;
-        }
-        StringMap map = localMap.get();
-        map = map == null ? createStringMap() : createStringMap(map);
-        for (final Map.Entry<String, V> entry : values.entrySet()) {
-            map.putValue(entry.getKey(), entry.getValue());
-        }
-        map.freeze();
-        localMap.set(map);
-    }
-
-    @Override
-    public String get(final String key) {
-        return (String) getValue(key);
-    }
-
-    @Override
-    public <V> V getValue(final String key) {
-        final StringMap map = localMap.get();
-        return map == null ? null : map.<V>getValue(key);
-    }
-
-    @Override
-    public void remove(final String key) {
-        final StringMap map = localMap.get();
-        if (map != null) {
-            final StringMap copy = createStringMap(map);
-            copy.remove(key);
-            copy.freeze();
-            localMap.set(copy);
-        }
-    }
-
-    @Override
-    public void removeAll(final Iterable<String> keys) {
-        final StringMap map = localMap.get();
-        if (map != null) {
-            final StringMap copy = createStringMap(map);
-            for (final String key : keys) {
-                copy.remove(key);
-            }
-            copy.freeze();
-            localMap.set(copy);
-        }
-    }
-
-    @Override
-    public void clear() {
-        localMap.remove();
-    }
-
-    @Override
-    public boolean containsKey(final String key) {
-        final StringMap map = localMap.get();
-        return map != null && map.containsKey(key);
-    }
-
-    @Override
-    public Map<String, String> getCopy() {
-        final StringMap map = localMap.get();
-        return map == null ? new HashMap<>() : map.toMap();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public StringMap getReadOnlyContextData() {
-        final StringMap map = localMap.get();
-        return map == null ? EMPTY_CONTEXT_DATA : map;
-    }
-
-    @Override
-    public Map<String, String> getImmutableMapOrNull() {
-        final StringMap map = localMap.get();
-        return map == null ? null : Collections.unmodifiableMap(map.toMap());
-    }
-
-    @Override
-    public boolean isEmpty() {
-        final StringMap map = localMap.get();
-        return map == null || map.isEmpty();
-    }
-
-    @Override
-    public String toString() {
-        final StringMap map = localMap.get();
-        return map == null ? "{}" : map.toString();
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        final StringMap map = this.localMap.get();
-        result = prime * result + ((map == null) ? 0 : map.hashCode());
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (!(obj instanceof ThreadContextMap)) {
-            return false;
-        }
-        final ThreadContextMap other = (ThreadContextMap) obj;
-        final Map<String, String> map = this.getImmutableMapOrNull();
-        final Map<String, String> otherMap = other.getImmutableMapOrNull();
-        return Objects.equals(map, otherMap);
-    }
-}
diff --git 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java
 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java
index 31e46c86d6..70044d87fd 100644
--- 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java
+++ 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java
@@ -38,7 +38,7 @@ import org.apache.logging.log4j.util.TriConsumer;
  *      linearly with the current map size, and callers are advised to 
minimize this work.
  * </p>
  */
-public class DefaultThreadContextMap implements ThreadContextMap, 
ReadOnlyStringMap {
+public class DefaultThreadContextMap implements ThreadContextMap, 
ReadOnlyStringMap, CopyOnWrite {
     private static final long serialVersionUID = -2635197170958057849L;
 
     /**
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/Provider.java 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/Provider.java
index 9a79024f70..bad793160d 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/spi/Provider.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/Provider.java
@@ -295,15 +295,9 @@ public class Provider {
             return NoOpThreadContextMap.INSTANCE;
         }
         final String threadContextMap = getThreadContextMap();
-        if (threadContextMap != null) {
-            switch (threadContextMap) {
-                case 
"org.apache.logging.log4j.spi.GarbageFreeSortedArrayThreadContextMap":
-                    return new GarbageFreeSortedArrayThreadContextMap();
-                case 
"org.apache.logging.log4j.spi.CopyOnWriteSortedArrayThreadContextMap":
-                    return new CopyOnWriteSortedArrayThreadContextMap();
-            }
-        }
-        return new DefaultThreadContextMap();
+        return 
"org.apache.logging.log4j.spi.GarbageFreeSortedArrayThreadContextMap".equals(threadContextMap)
+                ? new GarbageFreeSortedArrayThreadContextMap()
+                : new DefaultThreadContextMap();
     }
 
     /**
diff --git 
a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/async/AbstractAsyncThreadContextTestBase.java
 
b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/async/AbstractAsyncThreadContextTestBase.java
index 20f6791a2f..a1c3e7053c 100644
--- 
a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/async/AbstractAsyncThreadContextTestBase.java
+++ 
b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/async/AbstractAsyncThreadContextTestBase.java
@@ -92,8 +92,7 @@ public abstract class AbstractAsyncThreadContextTestBase {
 
     protected enum ContextImpl {
         WEBAPP("WebApp", 
"org.apache.logging.log4j.spi.DefaultThreadContextMap"),
-        GARBAGE_FREE("GarbageFree", 
"org.apache.logging.log4j.spi.GarbageFreeSortedArrayThreadContextMap"),
-        COPY_ON_WRITE("CopyOnWrite", 
"org.apache.logging.log4j.spi.CopyOnWriteSortedArrayThreadContextMap");
+        GARBAGE_FREE("GarbageFree", 
"org.apache.logging.log4j.spi.GarbageFreeSortedArrayThreadContextMap");
 
         private final String threadContextMap;
         private final String implClass;
diff --git 
a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/async/AsyncThreadContextCopyOnWriteTest.java
 
b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/async/AsyncThreadContextCopyOnWriteTest.java
deleted file mode 100644
index d42f350ff5..0000000000
--- 
a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/async/AsyncThreadContextCopyOnWriteTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.logging.log4j.core.async;
-
-import java.nio.file.Path;
-import org.apache.logging.log4j.core.test.junit.Tags;
-import org.apache.logging.log4j.test.junit.TempLoggingDir;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.EnumSource;
-
-// Note: the different ThreadContextMap implementations cannot be 
parameterized:
-// ThreadContext initialization will result in static final fields being set 
in various components.
-// To use a different ThreadContextMap, the test needs to be run in a new JVM.
-@Tag(Tags.ASYNC_LOGGERS)
-public class AsyncThreadContextCopyOnWriteTest extends 
AbstractAsyncThreadContextTestBase {
-
-    @TempLoggingDir
-    private static Path loggingPath;
-
-    @ParameterizedTest
-    @EnumSource
-    public void testAsyncLogWritesToLog(Mode asyncMode) throws Exception {
-        testAsyncLogWritesToLog(ContextImpl.COPY_ON_WRITE, asyncMode, 
loggingPath);
-    }
-}
diff --git 
a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjectorTest.java
 
b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjectorTest.java
index c94e5e1143..47034eb7bf 100644
--- 
a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjectorTest.java
+++ 
b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjectorTest.java
@@ -50,7 +50,6 @@ public class ThreadContextDataInjectorTest {
     @Parameters(name = "{0}")
     public static Collection<String[]> threadContextMapClassNames() {
         return asList(new String[][] {
-            
{"org.apache.logging.log4j.spi.CopyOnWriteSortedArrayThreadContextMap"},
             
{"org.apache.logging.log4j.spi.GarbageFreeSortedArrayThreadContextMap"},
             {"org.apache.logging.log4j.spi.DefaultThreadContextMap"}
         });
diff --git 
a/log4j-perf-test/src/main/java/org/apache/logging/log4j/perf/jmh/ThreadContextBenchmark.java
 
b/log4j-perf-test/src/main/java/org/apache/logging/log4j/perf/jmh/ThreadContextBenchmark.java
index e8de3a96f1..42f9f814ca 100644
--- 
a/log4j-perf-test/src/main/java/org/apache/logging/log4j/perf/jmh/ThreadContextBenchmark.java
+++ 
b/log4j-perf-test/src/main/java/org/apache/logging/log4j/perf/jmh/ThreadContextBenchmark.java
@@ -31,7 +31,6 @@ import org.apache.logging.log4j.core.impl.ContextData;
 import org.apache.logging.log4j.core.impl.ContextDataInjectorFactory;
 import org.apache.logging.log4j.core.impl.ThreadContextDataInjector;
 import org.apache.logging.log4j.perf.nogc.OpenHashStringMap;
-import org.apache.logging.log4j.spi.CopyOnWriteOpenHashMapThreadContextMap;
 import org.apache.logging.log4j.spi.DefaultThreadContextMap;
 import org.apache.logging.log4j.spi.GarbageFreeOpenHashMapThreadContextMap;
 import org.apache.logging.log4j.spi.ThreadContextMap;
@@ -73,26 +72,19 @@ import org.openjdk.jmh.annotations.Warmup;
 @State(Scope.Benchmark)
 public class ThreadContextBenchmark {
     private static final String DEFAULT_CONTEXT_MAP = "Default";
-    private static final String COPY_OPENHASH_MAP = "CopyOpenHash";
-    private static final String COPY_ARRAY_MAP = "CopySortedArray";
     private static final String NO_GC_OPENHASH_MAP = "NoGcOpenHash";
     private static final String NO_GC_ARRAY_MAP = "NoGcSortedArray";
     private static final Map<String, Class<? extends ThreadContextMap>> 
IMPLEMENTATIONS = new HashMap<>();
 
     static {
         IMPLEMENTATIONS.put(DEFAULT_CONTEXT_MAP, 
DefaultThreadContextMap.class);
-        IMPLEMENTATIONS.put(COPY_OPENHASH_MAP, 
CopyOnWriteOpenHashMapThreadContextMap.class);
-        IMPLEMENTATIONS.put(
-                COPY_ARRAY_MAP,
-                CopyOnWriteOpenHashMapThreadContextMap.SUPER); // 
CopyOnWriteSortedArrayThreadContextMap.class);
         IMPLEMENTATIONS.put(NO_GC_OPENHASH_MAP, 
GarbageFreeOpenHashMapThreadContextMap.class);
         IMPLEMENTATIONS.put(
                 NO_GC_ARRAY_MAP,
                 GarbageFreeOpenHashMapThreadContextMap.SUPER); // 
GarbageFreeSortedArrayThreadContextMap.class);
     }
 
-    @Param({"Default", "CopyOpenHash", "CopySortedArray", "NoGcOpenHash", 
"NoGcSortedArray"})
-    // @Param({ "Default", }) // for legecyInject benchmarks
+    @Param({"Default", "NoGcOpenHash", "NoGcSortedArray"})
     public String threadContextMapAlias;
 
     @Param({"5", "50", "500"})
diff --git 
a/log4j-perf-test/src/main/java/org/apache/logging/log4j/perf/jmh/ThreadContextVsScopedContextBenchmark.java
 
b/log4j-perf-test/src/main/java/org/apache/logging/log4j/perf/jmh/ThreadContextVsScopedContextBenchmark.java
index 76ac3d4d82..8a4de82032 100644
--- 
a/log4j-perf-test/src/main/java/org/apache/logging/log4j/perf/jmh/ThreadContextVsScopedContextBenchmark.java
+++ 
b/log4j-perf-test/src/main/java/org/apache/logging/log4j/perf/jmh/ThreadContextVsScopedContextBenchmark.java
@@ -31,7 +31,6 @@ import org.apache.logging.log4j.core.config.Configuration;
 import org.apache.logging.log4j.core.config.LoggerConfig;
 import org.apache.logging.log4j.core.layout.PatternLayout;
 import org.apache.logging.log4j.perf.appender.StringAppender;
-import org.apache.logging.log4j.spi.CopyOnWriteOpenHashMapThreadContextMap;
 import org.apache.logging.log4j.spi.DefaultThreadContextMap;
 import org.apache.logging.log4j.spi.GarbageFreeOpenHashMapThreadContextMap;
 import org.apache.logging.log4j.spi.ThreadContextMap;
@@ -91,18 +90,12 @@ public class ThreadContextVsScopedContextBenchmark {
     private static final Logger LOGGER = 
LogManager.getLogger(ThreadContextVsScopedContextBenchmark.class);
 
     private static final String DEFAULT_CONTEXT_MAP = "Default";
-    private static final String COPY_OPENHASH_MAP = "CopyOpenHash";
-    private static final String COPY_ARRAY_MAP = "CopySortedArray";
     private static final String NO_GC_OPENHASH_MAP = "NoGcOpenHash";
     private static final String NO_GC_ARRAY_MAP = "NoGcSortedArray";
     private static final Map<String, Class<? extends ThreadContextMap>> 
IMPLEMENTATIONS = new HashMap<>();
 
     static {
         IMPLEMENTATIONS.put(DEFAULT_CONTEXT_MAP, 
DefaultThreadContextMap.class);
-        IMPLEMENTATIONS.put(COPY_OPENHASH_MAP, 
CopyOnWriteOpenHashMapThreadContextMap.class);
-        IMPLEMENTATIONS.put(
-                COPY_ARRAY_MAP,
-                CopyOnWriteOpenHashMapThreadContextMap.SUPER); // 
CopyOnWriteSortedArrayThreadContextMap.class);
         IMPLEMENTATIONS.put(NO_GC_OPENHASH_MAP, 
GarbageFreeOpenHashMapThreadContextMap.class);
         IMPLEMENTATIONS.put(
                 NO_GC_ARRAY_MAP,
@@ -112,7 +105,7 @@ public class ThreadContextVsScopedContextBenchmark {
     @State(Scope.Benchmark)
     public static class ReadThreadContextState {
 
-        @Param({"Default", "CopySortedArray", "NoGcSortedArray", 
"StringArray"})
+        @Param({"Default", "NoGcSortedArray"})
         public String threadContextMapAlias;
 
         @Setup
diff --git 
a/log4j-perf-test/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteOpenHashMapThreadContextMap.java
 
b/log4j-perf-test/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteOpenHashMapThreadContextMap.java
deleted file mode 100644
index f43717494f..0000000000
--- 
a/log4j-perf-test/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteOpenHashMapThreadContextMap.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.logging.log4j.spi;
-
-import org.apache.logging.log4j.perf.nogc.OpenHashStringMap;
-import org.apache.logging.log4j.util.PropertiesUtil;
-import org.apache.logging.log4j.util.ReadOnlyStringMap;
-import org.apache.logging.log4j.util.StringMap;
-
-/**
- * {@code OpenHashStringMap}-based implementation of the {@code 
ThreadContextMap} interface that creates a copy of
- * the data structure on every modification. Any particular instance of the 
data structure is a snapshot of the
- * ThreadContext at some point in time and can safely be passed off to other 
threads
- *
- * @since 2.7
- */
-public class CopyOnWriteOpenHashMapThreadContextMap extends 
CopyOnWriteSortedArrayThreadContextMap {
-
-    /** Constant used in benchmark code */
-    public static final Class<? extends ThreadContextMap> SUPER = 
CopyOnWriteSortedArrayThreadContextMap.class;
-
-    @Override
-    protected StringMap createStringMap() {
-        return new OpenHashStringMap<>(PropertiesUtil.getProperties()
-                .getIntegerProperty(PROPERTY_NAME_INITIAL_CAPACITY, 
DEFAULT_INITIAL_CAPACITY));
-    }
-
-    @Override
-    protected StringMap createStringMap(final ReadOnlyStringMap original) {
-        return new OpenHashStringMap<>(original);
-    }
-}

Reply via email to