From 2acf6bdf7ad66a3927c99e5f767f4007eecd9274 Mon Sep 17 00:00:00 2001 From: Mark Payne Date: Tue, 17 Oct 2017 10:16:06 -0400 Subject: [PATCH] NIFI-3689: Fixed threading bug in TestWriteAheadStorePartition - multiple threads were simultaneously attempting to update HashMap. Changed impl to ConcurrentHashMap. Signed-off-by: Pierre Villard This closes #2214. --- .../nifi/provenance/store/TestWriteAheadStorePartition.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/test/java/org/apache/nifi/provenance/store/TestWriteAheadStorePartition.java b/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/test/java/org/apache/nifi/provenance/store/TestWriteAheadStorePartition.java index 3879411e1a..c17bafb1c4 100644 --- a/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/test/java/org/apache/nifi/provenance/store/TestWriteAheadStorePartition.java +++ b/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/test/java/org/apache/nifi/provenance/store/TestWriteAheadStorePartition.java @@ -22,10 +22,10 @@ import static org.junit.Assert.assertEquals; import java.io.File; import java.io.IOException; import java.util.Collections; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.atomic.AtomicLong; import java.util.stream.Collectors; @@ -72,7 +72,7 @@ public class TestWriteAheadStorePartition { partition.addEvents(Collections.singleton(TestUtil.createEvent())); } - final Map reindexedEvents = new HashMap<>(); + final Map reindexedEvents = new ConcurrentHashMap<>(); final EventIndex eventIndex = Mockito.mock(EventIndex.class); Mockito.doAnswer(new Answer() { @Override