Skip to content

Commit eb83289

Browse files
committed
fix #576 - synchronize collections used in listeners
1 parent 88cda79 commit eb83289

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/test/java/com/marklogic/client/test/datamovement/QueryBatcherIteratorTest.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@
2222
import java.io.File;
2323
import java.io.FileReader;
2424
import java.io.FileWriter;
25-
import java.util.*;
25+
import java.util.Arrays;
26+
import java.util.Collections;
27+
import java.util.HashSet;
28+
import java.util.Random;
29+
import java.util.Set;
2630
import java.util.concurrent.atomic.AtomicInteger;
2731

2832
import com.marklogic.client.io.SearchHandle;
@@ -142,7 +146,7 @@ public void test_B_InMemoryIterator() throws Exception {
142146
StructuredQueryBuilder sqb = new StructuredQueryBuilder();
143147
StructuredQueryDefinition query = sqb.value(sqb.jsonProperty("dept"), "HR");
144148
query.setCollections(qhbTestCollection);
145-
Set<String> uris = new HashSet<>();
149+
Set<String> uris = Collections.synchronizedSet(new HashSet<>());
146150
StringBuilder failures = new StringBuilder();
147151
QueryBatcher getUris = moveMgr.newQueryBatcher(query)
148152
.withThreadCount(6)
@@ -160,7 +164,7 @@ public void test_B_InMemoryIterator() throws Exception {
160164

161165
// now we have the uris, let's step through them
162166
AtomicInteger successDocs = new AtomicInteger();
163-
Set<String> uris2 = new HashSet<>();
167+
Set<String> uris2 = Collections.synchronizedSet(new HashSet<>());
164168
StringBuilder failures2 = new StringBuilder();
165169
QueryBatcher performDelete = moveMgr.newQueryBatcher(uris.iterator())
166170
.withThreadCount(2)

0 commit comments

Comments
 (0)