You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by tw...@apache.org on 2016/11/20 14:04:06 UTC

tinkerpop git commit: Added a short sleep to prevent traversal from finishing before it can be interrupted. [Forced Update!]

Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1548 3d826a8e4 -> 1d9725418 (forced update)


Added a short sleep to prevent traversal from finishing before it can be interrupted.


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

Branch: refs/heads/TINKERPOP-1548
Commit: 1d9725418fa53e0c0baa5c9982a9aaa1dd31e0d7
Parents: 7bb77c6
Author: Ted Wilmes <tw...@gmail.com>
Authored: Sun Nov 20 08:02:47 2016 -0600
Committer: Ted Wilmes <tw...@gmail.com>
Committed: Sun Nov 20 08:02:47 2016 -0600

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                     |  1 +
 .../traversal/TraversalInterruptionComputerTest.java   | 13 ++++++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1d972541/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 584f9e3..793e953 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -59,6 +59,7 @@ TinkerPop 3.2.4 (Release Date: NOT OFFICIALLY RELEASED YET)
 * Added a class loader to `TraversalStrategies.GlobalCache` which guarantees strategies are registered prior to `GlobalCache.getStrategies()`.
 * Fixed a severe bug where `GraphComputer` strategies are not being loaded until the second use of the traversal source.
 * The root traversal now throws regular `NoSuchElementException` instead of `FastNoSuchElementException`. (*breaking*)
+* Added a short sleep to prevent traversal from finishing before it can be interrupted during `TraversalInterruptionComputerTest`.
 
 [[release-3-2-3]]
 TinkerPop 3.2.3 (Release Date: October 17, 2016)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1d972541/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalInterruptionComputerTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalInterruptionComputerTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalInterruptionComputerTest.java
index c3a1042..32bbf42 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalInterruptionComputerTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalInterruptionComputerTest.java
@@ -75,6 +75,17 @@ public class TraversalInterruptionComputerTest extends AbstractGremlinProcessTes
             try {
                 final Traversal traversal = traversalMaker.apply(g).sideEffect(traverser -> {
                     startedIterating.countDown();
+                    try {
+                        // artificially slow down the traversal execution so that
+                        // this test has a chance to interrupt it before it finishes
+                        Thread.sleep(100);
+                    } catch (InterruptedException e) {
+                        // if the traversal is interrupted while in this
+                        // sleep, reassert the interrupt so that the thread is
+                        // re-marked as interrupted and correctly handled as
+                        // an interrupted traversal
+                        Thread.currentThread().interrupt();
+                    }
                 });
                 traversal.iterate();
             } catch (Exception ex) {
@@ -86,7 +97,7 @@ public class TraversalInterruptionComputerTest extends AbstractGremlinProcessTes
 
         // total time for test should not exceed 5 seconds - this prevents the test from just hanging and allows
         // it to finish with failure
-        assertThat(startedIterating.await(5000, TimeUnit.MILLISECONDS), CoreMatchers.is(true));
+        assertThat(startedIterating.await(1000, TimeUnit.MILLISECONDS), CoreMatchers.is(true));
 
         t.interrupt();
         t.join();