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/03/04 13:17:30 UTC

incubator-tinkerpop git commit: Make the handleIterator method throw a checked exception.

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/master 332f81279 -> 6efdbca73


Make the handleIterator method throw a checked exception.

This will make the expected error handling more explicity to  those extending the AbstractEvalOpProcessor.


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

Branch: refs/heads/master
Commit: 6efdbca732a4e7ed1984753ac87037d25bf534bf
Parents: 332f812
Author: Stephen Mallette <sp...@apache.org>
Authored: Wed Mar 4 07:12:37 2015 -0500
Committer: Stephen Mallette <sp...@apache.org>
Committed: Wed Mar 4 07:12:37 2015 -0500

----------------------------------------------------------------------
 .../gremlin/server/op/AbstractEvalOpProcessor.java  | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6efdbca7/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java
index 9258b35..2b0ab32 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java
@@ -158,7 +158,11 @@ public abstract class AbstractEvalOpProcessor implements OpProcessor {
 
             stopWatch.start();
 
-            handleIterator(ctx, msg, settings, itty, resultIterationBatchSize, stopWatch);
+            try {
+                handleIterator(ctx, msg, settings, itty, resultIterationBatchSize, stopWatch);
+            } catch (TimeoutException te) {
+                throw new RuntimeException(te);
+            }
 
             stopWatch.stop();
         }, executor);
@@ -177,7 +181,13 @@ public abstract class AbstractEvalOpProcessor implements OpProcessor {
         }, executor);
     }
 
-    protected void handleIterator(final ChannelHandlerContext ctx, final RequestMessage msg, final Settings settings, final Iterator itty, final int resultIterationBatchSize, final StopWatch stopWatch) {
+    /**
+     * Called by {@link #evalOpInternal} when iterating a result set.
+     *
+     * @throws TimeoutException if the time taken to serialize the entire result set exceeds the allowable time.
+     */
+    protected void handleIterator(final ChannelHandlerContext ctx, final RequestMessage msg, final Settings settings,
+                                  final Iterator itty, final int resultIterationBatchSize, final StopWatch stopWatch) throws TimeoutException {
         List<Object> aggregate = new ArrayList<>(resultIterationBatchSize);
         while (itty.hasNext()) {
             aggregate.add(itty.next());
@@ -193,7 +203,7 @@ public abstract class AbstractEvalOpProcessor implements OpProcessor {
 
             stopWatch.split();
             if (stopWatch.getSplitTime() > settings.serializedResponseTimeout)
-                throw new RuntimeException(new TimeoutException("Serialization of the entire response exceeded the serializeResponseTimeout setting"));
+                throw new TimeoutException("Serialization of the entire response exceeded the serializeResponseTimeout setting");
 
             stopWatch.unsplit();
         }