From 58ccb39deea9afb136d8ad9ce6defc7c67b52cad Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Sat, 13 Jun 2015 20:29:18 +0200 Subject: [PATCH] Use CopyOnWrite list since list is concurrently modified as well as iterated --- .../transport/ContextAndHeaderTransportTests.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/test/java/org/elasticsearch/transport/ContextAndHeaderTransportTests.java b/core/src/test/java/org/elasticsearch/transport/ContextAndHeaderTransportTests.java index 289659867d2..db9219785c8 100644 --- a/core/src/test/java/org/elasticsearch/transport/ContextAndHeaderTransportTests.java +++ b/core/src/test/java/org/elasticsearch/transport/ContextAndHeaderTransportTests.java @@ -57,6 +57,7 @@ import org.junit.Before; import org.junit.Test; import java.util.*; +import java.util.concurrent.CopyOnWriteArrayList; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; import static org.elasticsearch.common.settings.Settings.settingsBuilder; @@ -70,7 +71,7 @@ import static org.hamcrest.Matchers.*; @ClusterScope(scope = SUITE) public class ContextAndHeaderTransportTests extends ElasticsearchIntegrationTest { - private static final List requests = Collections.synchronizedList(new ArrayList()); + private static final List requests = new CopyOnWriteArrayList<>(); private String randomHeaderKey = randomAsciiOfLength(10); private String randomHeaderValue = randomAsciiOfLength(20); private String queryIndex = "query-" + randomAsciiOfLength(10).toLowerCase(Locale.ROOT);