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 2017/07/17 16:44:07 UTC
[1/3] tinkerpop git commit: Wrapped future in WeakReference
Repository: tinkerpop
Updated Branches:
refs/heads/master ad1b2f73f -> 236b2b81a
Wrapped future in WeakReference
This is an add-on change that should have been in place on TINKERPOP-1714. This should allow the result to be garbage collected without waiting for the timeout. CTR
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/2ba4104a
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/2ba4104a
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/2ba4104a
Branch: refs/heads/master
Commit: 2ba4104aaa3e93b0155331b6f5e410a0bd59b0d3
Parents: 5335f4a
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Jul 17 10:39:07 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Jul 17 10:39:07 2017 -0400
----------------------------------------------------------------------
.../tinkerpop/gremlin/groovy/engine/GremlinExecutor.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2ba4104a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
index d646a8c..d02d773 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
@@ -38,6 +38,7 @@ import javax.script.SimpleBindings;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
+import java.lang.ref.WeakReference;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
@@ -324,11 +325,12 @@ public class GremlinExecutor implements AutoCloseable {
return null;
});
- final Future<?> executionFuture = executorService.submit(evalFuture);
+ final WeakReference<Future<?>> executionFuture = new WeakReference<>(executorService.submit(evalFuture));
if (scriptEvalTimeOut > 0) {
// Schedule a timeout in the thread pool for future execution
scheduledExecutorService.schedule(() -> {
- if (executionFuture.cancel(true)) {
+ final Future<?> f = executionFuture.get();
+ if (f != null && f.cancel(true)) {
lifeCycle.getAfterTimeout().orElse(afterTimeout).accept(bindings);
evaluationFuture.completeExceptionally(new TimeoutException(
String.format("Script evaluation exceeded the configured 'scriptEvaluationTimeout' threshold of %s ms or evaluation was otherwise cancelled directly for request [%s]", scriptEvalTimeOut, script)));
[2/3] tinkerpop git commit: Increased timeout a bit for test.
Posted by sp...@apache.org.
Increased timeout a bit for test.
Wasn't giving enough time (suddenly) to handle the follow-on request that ensures calls work after a timeout has triggered. CTR
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/a5d60c6b
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/a5d60c6b
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/a5d60c6b
Branch: refs/heads/master
Commit: a5d60c6b844aee5169238f000b5fd0b66d850e61
Parents: 2ba4104
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Jul 17 11:36:14 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Jul 17 12:24:44 2017 -0400
----------------------------------------------------------------------
.../tinkerpop/gremlin/server/GremlinServerIntegrateTest.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a5d60c6b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
index aad8131..8b0c280 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
@@ -157,7 +157,7 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
settings.writeBufferLowWaterMark = 32;
break;
case "shouldReceiveFailureTimeOutOnScriptEval":
- settings.scriptEvaluationTimeout = 200;
+ settings.scriptEvaluationTimeout = 1000;
break;
case "shouldReceiveFailureTimeOutOnTotalSerialization":
settings.serializedResponseTimeout = 1;
@@ -699,7 +699,7 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
public void shouldReceiveFailureTimeOutOnScriptEval() throws Exception {
try (SimpleClient client = TestClientFactory.createWebSocketClient()){
final List<ResponseMessage> responses = client.submit("Thread.sleep(3000);'some-stuff-that-should not return'");
- assertThat(responses.get(0).getStatus().getMessage(), startsWith("Script evaluation exceeded the configured 'scriptEvaluationTimeout' threshold of 200 ms"));
+ assertThat(responses.get(0).getStatus().getMessage(), startsWith("Script evaluation exceeded the configured 'scriptEvaluationTimeout' threshold of 1000 ms"));
// validate that we can still send messages to the server
assertEquals(2, ((List<Integer>) client.submit("1+1").get(0).getResult().getData()).get(0).intValue());
[3/3] tinkerpop git commit: Merge branch 'tp32'
Posted by sp...@apache.org.
Merge branch 'tp32'
Conflicts:
gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/236b2b81
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/236b2b81
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/236b2b81
Branch: refs/heads/master
Commit: 236b2b81a659ceee535068dbea3eb523ea43f40c
Parents: ad1b2f7 a5d60c6
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Jul 17 12:43:58 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Jul 17 12:43:58 2017 -0400
----------------------------------------------------------------------
.../tinkerpop/gremlin/groovy/engine/GremlinExecutor.java | 9 +++++++--
.../gremlin/server/GremlinServerIntegrateTest.java | 4 ++--
2 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/236b2b81/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
----------------------------------------------------------------------
diff --cc gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
index a08941e,d02d773..f871525
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
@@@ -35,7 -35,12 +35,11 @@@ import javax.script.Compilable
import javax.script.CompiledScript;
import javax.script.ScriptException;
import javax.script.SimpleBindings;
+ import java.io.File;
+ import java.io.FileReader;
+ import java.io.IOException;
+ import java.lang.ref.WeakReference;
import java.lang.reflect.Method;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/236b2b81/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
----------------------------------------------------------------------