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 2015/02/13 17:29:35 UTC

incubator-tinkerpop git commit: Make it so that callback to the success function of a GremlinExecutor eval includes both script eval time and result transformation time.

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/master 79a1f1eae -> 12d17eed1


Make it so that callback to the success function of a GremlinExecutor eval includes both script eval time and result transformation time.


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

Branch: refs/heads/master
Commit: 12d17eed1bfeb151ee6a36a86c9e9c752d01f542
Parents: 79a1f1e
Author: Stephen Mallette <sp...@apache.org>
Authored: Fri Feb 13 11:28:54 2015 -0500
Committer: Stephen Mallette <sp...@apache.org>
Committed: Fri Feb 13 11:28:54 2015 -0500

----------------------------------------------------------------------
 .../gremlin/groovy/engine/GremlinExecutor.java       | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/12d17eed/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 20dfab9..70169d2 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
@@ -158,12 +158,12 @@ public class GremlinExecutor implements AutoCloseable {
 
                 final Object o = scriptEngines.eval(script, bindings, lang);
 
-                afterSuccess.accept(bindings);
-
                 // apply a transformation before sending back the result - useful when trying to force serialization
                 // in the same thread that the eval took place given ThreadLocal nature of graphs as well as some
                 // transactional constraints
                 evaluationFuture.complete(null == transformResult ? o : transformResult.apply(o));
+
+                afterSuccess.accept(bindings);
             } catch (Exception ex) {
                 final Throwable root = ExceptionUtils.getRootCause(ex);
 
@@ -416,9 +416,12 @@ public class GremlinExecutor implements AutoCloseable {
         }
 
         /**
-         * Amount of time a script has before it times out.
+         * Amount of time a script has before it times out. Note that the time required covers both script evaluation
+         * as well as any time needed for a post result transformation (if the transformation function is supplied
+         * to the {@link GremlinExecutor#eval}).
          *
-         * @param scriptEvaluationTimeout Time in milliseconds that a script is allowed to run.
+         * @param scriptEvaluationTimeout Time in milliseconds that a script is allowed to run and its
+         *                                results potentially transformed.
          */
         public Builder scriptEvaluationTimeout(final long scriptEvaluationTimeout) {
             this.scriptEvaluationTimeout = scriptEvaluationTimeout;
@@ -458,7 +461,9 @@ public class GremlinExecutor implements AutoCloseable {
         }
 
         /**
-         * A {@link Consumer} to execute just after successful script evaluation.
+         * A {@link Consumer} to execute just after successful script evaluation. Note that success will be called
+         * after evaluation of the script in the engine and after the results have passed through transformation
+         * (if a transform function is passed to the {@link GremlinExecutor#eval}.
          */
         public Builder afterSuccess(final Consumer<Bindings> afterSuccess) {
             this.afterSuccess = afterSuccess;