From c384776d6f9594450ff724214f4f20ede1c444b5 Mon Sep 17 00:00:00 2001 From: gtully Date: Thu, 7 Jan 2021 11:32:46 +0000 Subject: [PATCH] ARTEMIS-3033 - fix early visibility on cached simple string parts array --- .../org/apache/activemq/artemis/api/core/SimpleString.java | 3 +-- .../artemis/tests/performance/jmh/AddressMapPerfTest.java | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/SimpleString.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/SimpleString.java index 1bb9ed6da8..33b00eb522 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/SimpleString.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/SimpleString.java @@ -307,8 +307,7 @@ public final class SimpleString implements CharSequence, Serializable, Comparabl } pathsList.add(pathAccumulator.toString()); - paths = new String[pathsList.size()]; - pathsList.toArray(paths); + paths = pathsList.toArray(new String[0]); return paths; } diff --git a/tests/performance-jmh/src/main/java/org/apache/activemq/artemis/tests/performance/jmh/AddressMapPerfTest.java b/tests/performance-jmh/src/main/java/org/apache/activemq/artemis/tests/performance/jmh/AddressMapPerfTest.java index 5f4d7f0e05..f21298909e 100644 --- a/tests/performance-jmh/src/main/java/org/apache/activemq/artemis/tests/performance/jmh/AddressMapPerfTest.java +++ b/tests/performance-jmh/src/main/java/org/apache/activemq/artemis/tests/performance/jmh/AddressMapPerfTest.java @@ -62,7 +62,6 @@ public class AddressMapPerfTest { keys = new SimpleString[entries]; for (int i = 0; i < entries; i++) { keys[i] = SimpleString.toSimpleString("topic." + i % entriesLog2 + "." + i); - keys[i].getPaths(WILDCARD_CONFIGURATION.getDelimiter()); // getPaths is not thread safe } }