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:24:44 UTC

incubator-tinkerpop git commit: Simplify the method signature of handleIterator.

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/master 6efdbca73 -> 30e0604d2


Simplify the method signature of handleIterator.

Reduced signature to just three parameters and at the same time passed the all important Gremlin Server Context object to allow maximum flexibility for those extending the class.


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

Branch: refs/heads/master
Commit: 30e0604d2b2fe838dd96a8e4cb88ebf1e8f01f71
Parents: 6efdbca
Author: Stephen Mallette <sp...@apache.org>
Authored: Wed Mar 4 07:23:16 2015 -0500
Committer: Stephen Mallette <sp...@apache.org>
Committed: Wed Mar 4 07:23:16 2015 -0500

----------------------------------------------------------------------
 .../gremlin/server/op/AbstractEvalOpProcessor.java    | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/30e0604d/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 2b0ab32..e6dd7de 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
@@ -130,7 +130,6 @@ public abstract class AbstractEvalOpProcessor implements OpProcessor {
         final Timer.Context timerContext = evalOpTimer.time();
         final ChannelHandlerContext ctx = context.getChannelHandlerContext();
         final RequestMessage msg = context.getRequestMessage();
-        final Settings settings = context.getSettings();
         final GremlinExecutor gremlinExecutor = gremlinExecutorSupplier.get();
         final ExecutorService executor = gremlinExecutor.getExecutorService();
 
@@ -148,8 +147,6 @@ public abstract class AbstractEvalOpProcessor implements OpProcessor {
 
         final CompletableFuture<Void> iterationFuture = evalFuture.thenAcceptAsync(o -> {
             final Iterator itty = IteratorUtils.convertToIterator(o);
-            // the batch size can be overridden by the request
-            final int resultIterationBatchSize = (Integer) msg.optionalArgs(Tokens.ARGS_BATCH_SIZE).orElse(settings.resultIterationBatchSize);
 
             // timer for the total serialization time
             final StopWatch stopWatch = new StopWatch();
@@ -159,7 +156,7 @@ public abstract class AbstractEvalOpProcessor implements OpProcessor {
             stopWatch.start();
 
             try {
-                handleIterator(ctx, msg, settings, itty, resultIterationBatchSize, stopWatch);
+                handleIterator(context, itty, stopWatch);
             } catch (TimeoutException te) {
                 throw new RuntimeException(te);
             }
@@ -186,8 +183,13 @@ public abstract class AbstractEvalOpProcessor implements OpProcessor {
      *
      * @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 {
+    protected void handleIterator(final Context context, final Iterator itty, final StopWatch stopWatch) throws TimeoutException {
+        final ChannelHandlerContext ctx = context.getChannelHandlerContext();
+        final RequestMessage msg = context.getRequestMessage();
+        final Settings settings = context.getSettings();
+
+        // the batch size can be overridden by the request
+        final int resultIterationBatchSize = (Integer) msg.optionalArgs(Tokens.ARGS_BATCH_SIZE).orElse(settings.resultIterationBatchSize);
         List<Object> aggregate = new ArrayList<>(resultIterationBatchSize);
         while (itty.hasNext()) {
             aggregate.add(itty.next());