NIFI-3689: Fixed threading bug in TestWriteAheadStorePartition - multiple threads were simultaneously attempting to update HashMap. Changed impl to ConcurrentHashMap.

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes #2214.
This commit is contained in:
Mark Payne 2017-10-17 10:16:06 -04:00 committed by Pierre Villard
parent fb839fff56
commit 2acf6bdf7a
1 changed files with 2 additions and 2 deletions

View File

@ -22,10 +22,10 @@ import static org.junit.Assert.assertEquals;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -72,7 +72,7 @@ public class TestWriteAheadStorePartition {
partition.addEvents(Collections.singleton(TestUtil.createEvent())); partition.addEvents(Collections.singleton(TestUtil.createEvent()));
} }
final Map<ProvenanceEventRecord, StorageSummary> reindexedEvents = new HashMap<>(); final Map<ProvenanceEventRecord, StorageSummary> reindexedEvents = new ConcurrentHashMap<>();
final EventIndex eventIndex = Mockito.mock(EventIndex.class); final EventIndex eventIndex = Mockito.mock(EventIndex.class);
Mockito.doAnswer(new Answer<Object>() { Mockito.doAnswer(new Answer<Object>() {
@Override @Override