You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2016/02/12 17:11:21 UTC

incubator-tinkerpop git commit: Use synchronizedList for a script engine test that multithreads.

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/tp31 e982a0c1b -> ec4f489da


Use synchronizedList for a script engine test that multithreads.

ArrayList isn't thread-safe and may have been causing random test failures. CTR


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/ec4f489d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/ec4f489d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/ec4f489d

Branch: refs/heads/tp31
Commit: ec4f489dafe920b28a43a6a65eba1f92b8745877
Parents: e982a0c
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Feb 12 11:04:34 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Feb 12 11:11:09 2016 -0500

----------------------------------------------------------------------
 .../gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java    | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/ec4f489d/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
index cddea53..3765d42 100644
--- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
@@ -25,7 +25,6 @@ import org.apache.tinkerpop.gremlin.groovy.NoImportCustomizerProvider;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
 import org.javatuples.Pair;
-import org.javatuples.Triplet;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -38,9 +37,11 @@ import javax.script.SimpleBindings;
 import java.awt.*;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -336,7 +337,7 @@ public class GremlinGroovyScriptEngineTest {
         final GremlinGroovyScriptEngine scriptEngine = new GremlinGroovyScriptEngine();
 
         final int max = 256;
-        final List<Pair<Integer, List<Integer>>> futures = new ArrayList<>(max);
+        final List<Pair<Integer, List<Integer>>> futures = Collections.synchronizedList(new ArrayList<>(max));
         IntStream.range(0, max).forEach(i -> {
             final int yValue = i * 2;
             final int zValue = i * -1;