taking a lunch break --- added more JavaDoc and started honing in on how withProcessor() will generalize... sorta tricky.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/3bf924b4 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/3bf924b4 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/3bf924b4 Branch: refs/heads/TINKERPOP-1564 Commit: 3bf924b4a8f5cc51c372ca9020f659e2aaf5eda7 Parents: cf26e54 Author: Marko A. Rodriguez <okramma...@gmail.com> Authored: Thu Dec 15 12:08:57 2016 -0700 Committer: Marko A. Rodriguez <okramma...@gmail.com> Committed: Thu Jan 19 13:01:41 2017 -0700 ---------------------------------------------------------------------- .../tinkerpop/gremlin/process/actor/Actors.java | 4 +--- .../gremlin/process/actor/GraphActors.java | 19 +++++++++++++++++++ .../gremlin/process/computer/Computer.java | 14 +------------- 3 files changed, 21 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3bf924b4/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/actor/Actors.java ---------------------------------------------------------------------- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/actor/Actors.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/actor/Actors.java index d3b5d17..bba7674 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/actor/Actors.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/actor/Actors.java @@ -75,8 +75,6 @@ public final class Actors implements Processor.Description<GraphActors> { @Override public TraversalSource addTraversalStrategies(final TraversalSource traversalSource) { - final ActorProgramStrategy actorProgramStrategy = new ActorProgramStrategy(this); - traversalSource.getStrategies().addStrategies(actorProgramStrategy); - return traversalSource; + return traversalSource.withStrategies(new ActorProgramStrategy(this)); } } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3bf924b4/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/actor/GraphActors.java ---------------------------------------------------------------------- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/actor/GraphActors.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/actor/GraphActors.java index c19dbf7..0cc2790 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/actor/GraphActors.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/actor/GraphActors.java @@ -32,9 +32,28 @@ import java.util.concurrent.Future; */ public interface GraphActors<R> extends Processor { + /** + * Provide the {@link ActorProgram} that the GraphActors will execute. + * + * @param program the program to execute + * @return the updated GraphActors with newly defined program + */ public GraphActors<R> program(final ActorProgram<R> program); + /** + * Provide the {@link Partitioner} that the GraphActors will execute over. + * Typically, there will be a single {@link org.apache.tinkerpop.gremlin.process.actor.Actor.Worker} + * for each {@link org.apache.tinkerpop.gremlin.structure.Partition} in the partitioner. + * + * @param partitioner the partitioner defining the data partitions + * @return the updated GraphActors with newly defined partitioner + */ public GraphActors<R> partitioner(final Partitioner partitioner); + /** + * Submit the {@link ActorProgram} for execution by the {@link GraphActors}. + * + * @return a {@link Future} denoting a reference to the asynchronous computation's result + */ public Future<R> submit(); } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3bf924b4/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java ---------------------------------------------------------------------- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java index 8691a41..96d5e7c 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java @@ -169,19 +169,7 @@ public final class Computer implements Processor.Description<GraphComputer>, Fun @Override public TraversalSource addTraversalStrategies(final TraversalSource traversalSource) { - Class<? extends GraphComputer> graphComputerClass; - if (this.getGraphComputerClass().equals(GraphComputer.class)) { - try { - graphComputerClass = this.apply(traversalSource.getGraph()).getClass(); - } catch (final Exception e) { - graphComputerClass = GraphComputer.class; - } - } else - graphComputerClass = this.getGraphComputerClass(); - final List<TraversalStrategy<?>> graphComputerStrategies = TraversalStrategies.GlobalCache.getStrategies(graphComputerClass).toList(); - traversalSource.getStrategies().addStrategies(graphComputerStrategies.toArray(new TraversalStrategy[graphComputerStrategies.size()])); - traversalSource.getStrategies().addStrategies(new VertexProgramStrategy(this)); - return traversalSource; + return traversalSource.withStrategies(new VertexProgramStrategy(this)); } /////////////////