You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by dk...@apache.org on 2015/05/11 13:43:57 UTC

[26/50] [abbrv] incubator-tinkerpop git commit: VertexProgram.loadState(Graph, Configuration) yielded a ripple of code gutting. I can't believe how much work I did to get around not having the Graph instance during an OLAP job. Pointless --- the code is m

VertexProgram.loadState(Graph,Configuration) yielded a ripple of code gutting. I can't believe how much work I did to get around not having the Graph instance during an OLAP job. Pointless --- the code is much simpler. Lots more clean up to do and docs/etc., but wow This makes life alot easier.


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

Branch: refs/heads/TINKERPOP3-666
Commit: 80e511c74835fe5b2c67daab27505c413b8c8c85
Parents: 134984e
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Fri May 8 14:42:12 2015 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Fri May 8 14:42:22 2015 -0600

----------------------------------------------------------------------
 .../peerpressure/PeerPressureVertexProgram.java |  34 +--
 .../ranking/pagerank/PageRankVertexProgram.java |  38 +--
 .../traversal/TraversalObjectFunction.java      |  47 +++
 .../traversal/TraversalScriptFunction.java      |  69 +++++
 .../traversal/TraversalScriptSupplier.java      |  67 -----
 .../computer/traversal/TraversalSupplier.java   |  43 ---
 .../traversal/TraversalVertexProgram.java       |  35 +--
 .../traversal/step/map/ComputerResultStep.java  |   2 +-
 .../computer/util/ConfigurationTraversal.java   |  82 ++++++
 .../process/computer/util/LambdaHolder.java     | 114 --------
 .../process/computer/util/ShellGraph.java       | 283 -------------------
 .../process/traversal/TraversalStrategies.java  |   5 -
 .../dsl/graph/GraphTraversalSource.java         |   2 +-
 .../traversal/step/util/ComputerAwareStep.java  |   2 +-
 .../step/util/ReducingBarrierStep.java          |   3 +-
 .../traversal/util/DefaultTraversal.java        |   2 +-
 .../process/computer/ComputerTestHelper.groovy  |   6 +-
 .../groovy/plugin/HadoopRemoteAcceptor.java     |   2 +-
 .../computer/example/TraversalSupplier1.java    |  12 +-
 .../computer/example/TraversalSupplier2.java    |   3 +-
 .../computer/example/TraversalSupplier3.java    |   3 +-
 21 files changed, 265 insertions(+), 589 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/80e511c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java
index 323dd15..907179a 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java
@@ -23,10 +23,13 @@ import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
 import org.apache.tinkerpop.gremlin.process.computer.Memory;
 import org.apache.tinkerpop.gremlin.process.computer.MessageScope;
 import org.apache.tinkerpop.gremlin.process.computer.Messenger;
+import org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalObjectFunction;
+import org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalScriptFunction;
 import org.apache.tinkerpop.gremlin.process.computer.util.AbstractVertexProgramBuilder;
-import org.apache.tinkerpop.gremlin.process.computer.util.LambdaHolder;
+import org.apache.tinkerpop.gremlin.process.computer.util.ConfigurationTraversal;
 import org.apache.tinkerpop.gremlin.process.computer.util.StaticVertexProgram;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.MapHelper;
 import org.apache.tinkerpop.gremlin.structure.Edge;
@@ -61,10 +64,10 @@ public class PeerPressureVertexProgram extends StaticVertexProgram<Pair<Serializ
 
     private static final String MAX_ITERATIONS = "gremlin.peerPressureVertexProgram.maxIterations";
     private static final String DISTRIBUTE_VOTE = "gremlin.peerPressureVertexProgram.distributeVote";
-    private static final String INCIDENT_TRAVERSAL_SUPPLIER = "gremlin.peerPressureVertexProgram.incidentTraversalSupplier";
+    private static final String TRAVERSAL_SUPPLIER = "gremlin.peerPressureVertexProgram.traversalSupplier";
     private static final String VOTE_TO_HALT = "gremlin.peerPressureVertexProgram.voteToHalt";
 
-    private LambdaHolder<Supplier<Traversal<Vertex, Edge>>> traversalSupplier;
+    private ConfigurationTraversal<Vertex, Edge> configurationTraversal;
     private int maxIterations = 30;
     private boolean distributeVote = false;
 
@@ -77,9 +80,9 @@ public class PeerPressureVertexProgram extends StaticVertexProgram<Pair<Serializ
 
     @Override
     public void loadState(final Graph graph, final Configuration configuration) {
-        this.traversalSupplier = LambdaHolder.loadState(configuration, INCIDENT_TRAVERSAL_SUPPLIER);
-        if (null != this.traversalSupplier) {
-            this.voteScope = MessageScope.Local.of(this.traversalSupplier.get());
+        if (configuration.containsKey(TRAVERSAL_SUPPLIER)) {
+            this.configurationTraversal = ConfigurationTraversal.loadState(graph, configuration, TRAVERSAL_SUPPLIER);
+            this.voteScope = MessageScope.Local.of(this.configurationTraversal);
             this.countScope = MessageScope.Local.of(new MessageScope.Local.ReverseTraversalSupplier(this.voteScope));
         }
         this.maxIterations = configuration.getInt(MAX_ITERATIONS, 30);
@@ -89,7 +92,7 @@ public class PeerPressureVertexProgram extends StaticVertexProgram<Pair<Serializ
     @Override
     public void storeState(final Configuration configuration) {
         super.storeState(configuration);
-        this.traversalSupplier.storeState(configuration);
+        this.configurationTraversal.storeState(configuration);
         configuration.setProperty(MAX_ITERATIONS, this.maxIterations);
         configuration.setProperty(DISTRIBUTE_VOTE, this.distributeVote);
 
@@ -211,22 +214,19 @@ public class PeerPressureVertexProgram extends StaticVertexProgram<Pair<Serializ
             return this;
         }
 
-        public Builder incident(final String scriptEngine, final String traversalScript) {
-            LambdaHolder.storeState(this.configuration, LambdaHolder.Type.SCRIPT, INCIDENT_TRAVERSAL_SUPPLIER, new String[]{scriptEngine, traversalScript});
+        public Builder traversal(final TraversalSource.Builder builder, final String scriptEngine, final String traversalScript, final Object... bindings) {
+            ConfigurationTraversal.storeState(new TraversalScriptFunction<>(builder, scriptEngine, traversalScript, bindings), this.configuration, TRAVERSAL_SUPPLIER);
             return this;
         }
 
-        public Builder incident(final String traversalScript) {
-            return incident(GREMLIN_GROOVY, traversalScript);
-        }
-
-        public Builder incident(final Supplier<Traversal<Vertex, Edge>> traversal) {
-            LambdaHolder.storeState(this.configuration, LambdaHolder.Type.OBJECT, INCIDENT_TRAVERSAL_SUPPLIER, traversal);
+        public Builder traversal(final Traversal.Admin<Vertex, Edge> traversal) {
+            ConfigurationTraversal.storeState(new TraversalObjectFunction<>(traversal), this.configuration, TRAVERSAL_SUPPLIER);
             return this;
         }
 
-        public Builder incident(final Class<Supplier<Traversal<Vertex, Edge>>> traversalClass) {
-            LambdaHolder.storeState(this.configuration, LambdaHolder.Type.CLASS, INCIDENT_TRAVERSAL_SUPPLIER, traversalClass);
+
+        public Builder traversal(final Class<Supplier<Traversal.Admin<Vertex, Edge>>> traversalClass) {
+            ConfigurationTraversal.storeState(traversalClass, this.configuration, TRAVERSAL_SUPPLIER);
             return this;
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/80e511c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/ranking/pagerank/PageRankVertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/ranking/pagerank/PageRankVertexProgram.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/ranking/pagerank/PageRankVertexProgram.java
index 96492b6..bc07e99 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/ranking/pagerank/PageRankVertexProgram.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/ranking/pagerank/PageRankVertexProgram.java
@@ -24,10 +24,13 @@ import org.apache.tinkerpop.gremlin.process.computer.Memory;
 import org.apache.tinkerpop.gremlin.process.computer.MessageCombiner;
 import org.apache.tinkerpop.gremlin.process.computer.MessageScope;
 import org.apache.tinkerpop.gremlin.process.computer.Messenger;
+import org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalObjectFunction;
+import org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalScriptFunction;
 import org.apache.tinkerpop.gremlin.process.computer.util.AbstractVertexProgramBuilder;
-import org.apache.tinkerpop.gremlin.process.computer.util.LambdaHolder;
+import org.apache.tinkerpop.gremlin.process.computer.util.ConfigurationTraversal;
 import org.apache.tinkerpop.gremlin.process.computer.util.StaticVertexProgram;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Graph;
@@ -40,7 +43,7 @@ import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Optional;
 import java.util.Set;
-import java.util.function.Supplier;
+import java.util.function.Function;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
@@ -56,9 +59,9 @@ public class PageRankVertexProgram extends StaticVertexProgram<Double> {
     private static final String VERTEX_COUNT = "gremlin.pageRankVertexProgram.vertexCount";
     private static final String ALPHA = "gremlin.pageRankVertexProgram.alpha";
     private static final String TOTAL_ITERATIONS = "gremlin.pageRankVertexProgram.totalIterations";
-    private static final String INCIDENT_TRAVERSAL_SUPPLIER = "gremlin.pageRankVertexProgram.incidentTraversalSupplier";
+    private static final String TRAVERSAL_SUPPLIER = "gremlin.pageRankVertexProgram.traversalSupplier";
 
-    private LambdaHolder<Supplier<Traversal<Vertex, Edge>>> traversalSupplier;
+    private ConfigurationTraversal<Vertex, Edge> configurationTraversal;
     private double vertexCountAsDouble = 1.0d;
     private double alpha = 0.85d;
     private int totalIterations = 30;
@@ -71,9 +74,9 @@ public class PageRankVertexProgram extends StaticVertexProgram<Double> {
 
     @Override
     public void loadState(final Graph graph, final Configuration configuration) {
-        this.traversalSupplier = LambdaHolder.loadState(configuration, INCIDENT_TRAVERSAL_SUPPLIER);
-        if (null != this.traversalSupplier) {
-            this.incidentMessageScope = MessageScope.Local.of(this.traversalSupplier.get());
+        if (configuration.containsKey(TRAVERSAL_SUPPLIER)) {
+            this.configurationTraversal = ConfigurationTraversal.loadState(graph, configuration, TRAVERSAL_SUPPLIER);
+            this.incidentMessageScope = MessageScope.Local.of(this.configurationTraversal);
             this.countMessageScope = MessageScope.Local.of(new MessageScope.Local.ReverseTraversalSupplier(this.incidentMessageScope));
         }
         this.vertexCountAsDouble = configuration.getDouble(VERTEX_COUNT, 1.0d);
@@ -87,8 +90,8 @@ public class PageRankVertexProgram extends StaticVertexProgram<Double> {
         configuration.setProperty(VERTEX_COUNT, this.vertexCountAsDouble);
         configuration.setProperty(ALPHA, this.alpha);
         configuration.setProperty(TOTAL_ITERATIONS, this.totalIterations);
-        if (null != this.traversalSupplier) {
-            this.traversalSupplier.storeState(configuration);
+        if (null != this.configurationTraversal) {
+            this.configurationTraversal.storeState(configuration);
         }
     }
 
@@ -174,22 +177,19 @@ public class PageRankVertexProgram extends StaticVertexProgram<Double> {
             return this;
         }
 
-        public Builder incident(final String scriptEngine, final String traversalScript) {
-            LambdaHolder.storeState(this.configuration, LambdaHolder.Type.SCRIPT, INCIDENT_TRAVERSAL_SUPPLIER, new String[]{scriptEngine, traversalScript});
+        public Builder traversal(final TraversalSource.Builder builder, final String scriptEngine, final String traversalScript, final Object... bindings) {
+            ConfigurationTraversal.storeState(new TraversalScriptFunction<>(builder, scriptEngine, traversalScript, bindings), this.configuration, TRAVERSAL_SUPPLIER);
             return this;
         }
 
-        public Builder incident(final String traversalScript) {
-            return incident(GREMLIN_GROOVY, traversalScript);
-        }
-
-        public Builder incident(final Supplier<Traversal<Vertex, Edge>> traversal) {
-            LambdaHolder.storeState(this.configuration, LambdaHolder.Type.OBJECT, INCIDENT_TRAVERSAL_SUPPLIER, traversal);
+        public Builder traversal(final Traversal.Admin<Vertex, Edge> traversal) {
+            ConfigurationTraversal.storeState(new TraversalObjectFunction<>(traversal), this.configuration, TRAVERSAL_SUPPLIER);
             return this;
         }
 
-        public Builder incident(final Class<Supplier<Traversal<Vertex, Edge>>> traversalClass) {
-            LambdaHolder.storeState(this.configuration, LambdaHolder.Type.CLASS, INCIDENT_TRAVERSAL_SUPPLIER, traversalClass);
+
+        public Builder traversal(final Class<Function<Graph, Traversal.Admin<Vertex, Edge>>> traversalClass) {
+            ConfigurationTraversal.storeState(traversalClass, this.configuration, TRAVERSAL_SUPPLIER);
             return this;
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/80e511c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalObjectFunction.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalObjectFunction.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalObjectFunction.java
new file mode 100644
index 0000000..662d8fa
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalObjectFunction.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.process.computer.traversal;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+
+import java.io.Serializable;
+import java.util.function.Function;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class TraversalObjectFunction<S, E> implements Function<Graph, Traversal.Admin<S, E>>, Serializable {
+
+    private final Traversal.Admin<S, E> traversal;
+
+    public TraversalObjectFunction(final Traversal.Admin<S, E> traversal) {
+        this.traversal = traversal;
+    }
+
+    @Override
+    public Traversal.Admin<S, E> apply(final Graph graph) {
+        final Traversal.Admin<S, E> clone = this.traversal.clone();
+        if (!clone.isLocked()) {
+            clone.setGraph(graph);
+            clone.applyStrategies();
+        }
+        return clone;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/80e511c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalScriptFunction.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalScriptFunction.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalScriptFunction.java
new file mode 100644
index 0000000..abce73a
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalScriptFunction.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.process.computer.traversal;
+
+import org.apache.tinkerpop.gremlin.process.computer.util.ScriptEngineCache;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+
+import javax.script.Bindings;
+import javax.script.ScriptEngine;
+import javax.script.ScriptException;
+import java.io.Serializable;
+import java.util.function.Function;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class TraversalScriptFunction<S, E> implements Function<Graph, Traversal.Admin<S, E>>, Serializable {
+
+    private final TraversalSource.Builder traversalContextBuilder;
+    private final String scriptEngineName;
+    private final String traversalScript;
+    private final Object[] bindings;
+
+    public TraversalScriptFunction(final TraversalSource.Builder traversalContextBuilder, final String scriptEngineName, final String traversalScript, final Object... bindings) {
+        this.traversalContextBuilder = traversalContextBuilder;
+        this.scriptEngineName = scriptEngineName;
+        this.traversalScript = traversalScript;
+        this.bindings = bindings;
+    }
+
+    public Traversal.Admin<S, E> apply(final Graph graph) {
+        try {
+            final ScriptEngine engine = ScriptEngineCache.get(this.scriptEngineName);
+            final Bindings engineBindings = engine.createBindings();
+            engineBindings.put("g", this.traversalContextBuilder.create(graph));
+            if (this.bindings.length % 2 != 0)
+                throw new IllegalArgumentException("The provided key/value bindings array length must be a multiple of two");
+            for (int i = 0; i < this.bindings.length; i = i + 2) {
+                engineBindings.put((String) this.bindings[i], this.bindings[i + 1]);
+            }
+            final Traversal.Admin<S, E> traversal = (Traversal.Admin<S, E>) engine.eval(this.traversalScript, engineBindings);
+            if (!traversal.isLocked()) {
+                traversal.setGraph(graph);
+                traversal.applyStrategies();
+            }
+            return traversal;
+        } catch (final ScriptException e) {
+            throw new IllegalStateException(e.getMessage(), e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/80e511c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalScriptSupplier.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalScriptSupplier.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalScriptSupplier.java
deleted file mode 100644
index 1df5828..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalScriptSupplier.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.computer.traversal;
-
-import org.apache.tinkerpop.gremlin.process.computer.util.ScriptEngineCache;
-import org.apache.tinkerpop.gremlin.process.computer.util.ShellGraph;
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-
-import javax.script.Bindings;
-import javax.script.ScriptEngine;
-import javax.script.ScriptException;
-import java.io.Serializable;
-import java.util.function.Supplier;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class TraversalScriptSupplier<S, E> implements Supplier<Traversal.Admin<S, E>>, Serializable {
-
-    private final TraversalSource.Builder traversalContextBuilder;
-    private final Class<? extends Graph> graphClass;
-    private final String scriptEngineName;
-    private final String traversalScript;
-    private final Object[] bindings;
-
-    public TraversalScriptSupplier(final Class<? extends Graph> graphClass, final TraversalSource.Builder traversalContextBuilder, final String scriptEngineName, final String traversalScript, final Object... bindings) {
-        this.traversalContextBuilder = traversalContextBuilder;
-        this.graphClass = graphClass;
-        this.scriptEngineName = scriptEngineName;
-        this.traversalScript = traversalScript;
-        this.bindings = bindings;
-    }
-
-    public Traversal.Admin<S, E> get() {
-        try {
-            final ScriptEngine engine = ScriptEngineCache.get(this.scriptEngineName);
-            final Bindings engineBindings = engine.createBindings();
-            engineBindings.put("g", this.traversalContextBuilder.create(ShellGraph.of(this.graphClass)));
-            if (this.bindings.length % 2 != 0)
-                throw new IllegalArgumentException("The provided key/value bindings array length must be a multiple of two");
-            for (int i = 0; i < this.bindings.length; i = i + 2) {
-                engineBindings.put((String) this.bindings[i], this.bindings[i + 1]);
-            }
-            return (Traversal.Admin<S, E>) engine.eval(this.traversalScript, engineBindings);
-        } catch (final ScriptException e) {
-            throw new IllegalStateException(e.getMessage(), e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/80e511c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalSupplier.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalSupplier.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalSupplier.java
deleted file mode 100644
index c8e7ff7..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalSupplier.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.computer.traversal;
-
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-
-import java.io.Serializable;
-import java.util.function.Supplier;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class TraversalSupplier<S, E> implements Supplier<Traversal.Admin<S, E>>, Serializable {
-
-    private final Traversal.Admin<S, E> traversal;
-    private final boolean cloneOnGet;
-
-    public TraversalSupplier(final Traversal.Admin<S, E> traversal, final boolean cloneOnGet) {
-        this.traversal = traversal;
-        this.cloneOnGet = cloneOnGet;
-    }
-
-    @Override
-    public Traversal.Admin<S, E> get() {
-        return this.cloneOnGet ? this.traversal.clone() : this.traversal;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/80e511c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java
index 7b4e8b0..581a263 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java
@@ -30,7 +30,7 @@ import org.apache.tinkerpop.gremlin.process.computer.VertexProgram;
 import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.ComputerResultStep;
 import org.apache.tinkerpop.gremlin.process.computer.traversal.step.sideEffect.mapreduce.TraverserMapReduce;
 import org.apache.tinkerpop.gremlin.process.computer.util.AbstractVertexProgramBuilder;
-import org.apache.tinkerpop.gremlin.process.computer.util.LambdaHolder;
+import org.apache.tinkerpop.gremlin.process.computer.util.ConfigurationTraversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalSideEffects;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
@@ -58,6 +58,7 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Optional;
 import java.util.Set;
+import java.util.function.Function;
 import java.util.function.Supplier;
 
 
@@ -83,7 +84,7 @@ public final class TraversalVertexProgram implements VertexProgram<TraverserSet<
     private static final Set<String> ELEMENT_COMPUTE_KEYS = new HashSet<>(Arrays.asList(HALTED_TRAVERSERS, TraversalSideEffects.SIDE_EFFECTS));
     private static final Set<String> MEMORY_COMPUTE_KEYS = new HashSet<>(Collections.singletonList(VOTE_TO_HALT));
 
-    private LambdaHolder<Supplier<Traversal.Admin<?, ?>>> traversalSupplier;
+    private ConfigurationTraversal<?, ?> configurationTraversal;
     private Traversal.Admin<?, ?> traversal;
     private TraversalMatrix<?, ?> traversalMatrix;
 
@@ -110,15 +111,11 @@ public final class TraversalVertexProgram implements VertexProgram<TraverserSet<
 
     @Override
     public void loadState(final Graph graph, final Configuration configuration) {
-        this.traversalSupplier = LambdaHolder.loadState(configuration, TRAVERSAL_SUPPLIER);
-        if (null == this.traversalSupplier) {
+        this.configurationTraversal = ConfigurationTraversal.loadState(graph, configuration, TRAVERSAL_SUPPLIER);
+        if (null == this.configurationTraversal) {
             throw new IllegalArgumentException("The configuration does not have a traversal supplier");
         }
-        this.traversal = this.traversalSupplier.get().get();
-        if (!this.traversal.isLocked()) {
-            this.traversal.setGraph(graph);
-            this.traversal.applyStrategies();
-        }
+        this.traversal = this.configurationTraversal.get();
         ((ComputerResultStep) this.traversal.getEndStep()).byPass();
         this.traversalMatrix = new TraversalMatrix<>(this.traversal);
         for (final MapReducer<?, ?, ?, ?, ?> mapReducer : TraversalHelper.getStepsOfAssignableClassRecursively(MapReducer.class, this.traversal)) {
@@ -131,7 +128,7 @@ public final class TraversalVertexProgram implements VertexProgram<TraverserSet<
     @Override
     public void storeState(final Configuration configuration) {
         VertexProgram.super.storeState(configuration);
-        this.traversalSupplier.storeState(configuration);
+        this.configurationTraversal.storeState(configuration);
     }
 
     @Override
@@ -283,25 +280,19 @@ public final class TraversalVertexProgram implements VertexProgram<TraverserSet<
             super(TraversalVertexProgram.class);
         }
 
-        public Builder traversal(final Class<? extends Graph> graphClass, final TraversalSource.Builder builder, final String scriptEngine, final String traversalScript, final Object... bindings) {
-            LambdaHolder.storeState(this.configuration, LambdaHolder.Type.SERIALIZED_OBJECT, TRAVERSAL_SUPPLIER, new TraversalScriptSupplier<>(graphClass, builder, scriptEngine, traversalScript, bindings));
+        public Builder traversal(final TraversalSource.Builder builder, final String scriptEngine, final String traversalScript, final Object... bindings) {
+            ConfigurationTraversal.storeState(new TraversalScriptFunction<>(builder, scriptEngine, traversalScript, bindings), this.configuration, TRAVERSAL_SUPPLIER);
             return this;
         }
 
         public Builder traversal(final Traversal.Admin<?, ?> traversal) {
-            return this.traversal(traversal, true);
-        }
-
-        public Builder traversal(final Traversal.Admin<?, ?> traversal, boolean serialize) {
-            if (serialize)
-                LambdaHolder.storeState(this.configuration, LambdaHolder.Type.SERIALIZED_OBJECT, TRAVERSAL_SUPPLIER, new TraversalSupplier<>(traversal, false));
-            else
-                LambdaHolder.storeState(this.configuration, LambdaHolder.Type.OBJECT, TRAVERSAL_SUPPLIER, new TraversalSupplier<>(traversal, true));
+            ConfigurationTraversal.storeState(new TraversalObjectFunction<>(traversal), this.configuration, TRAVERSAL_SUPPLIER);
             return this;
         }
 
-        public Builder traversal(final Class<Supplier<Traversal.Admin>> traversalClass) {
-            LambdaHolder.storeState(this.configuration, LambdaHolder.Type.CLASS, TRAVERSAL_SUPPLIER, traversalClass);
+
+        public Builder traversal(final Class<Function<Graph,Traversal.Admin<?, ?>>> traversalClass) {
+            ConfigurationTraversal.storeState(traversalClass, this.configuration, TRAVERSAL_SUPPLIER);
             return this;
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/80e511c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/ComputerResultStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/ComputerResultStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/ComputerResultStep.java
index a5e49c9..a40ae0f 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/ComputerResultStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/ComputerResultStep.java
@@ -76,7 +76,7 @@ public final class ComputerResultStep<S> extends AbstractStep<S, S> {
         if (this.byPass) return this.starts.next();
         if (this.first && null == this.computerResult) {
             try {
-                populateTraversers(this.graphComputer.program(TraversalVertexProgram.build().traversal(this.getTraversal(), !this.graphComputer.features().supportsDirectObjects()).create(this.graph)).submit().get());
+                populateTraversers(this.graphComputer.program(TraversalVertexProgram.build().traversal(this.getTraversal()).create(this.graph)).submit().get());
             } catch (final Exception e) {
                 throw new IllegalStateException(e.getMessage(), e);
             }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/80e511c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/ConfigurationTraversal.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/ConfigurationTraversal.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/ConfigurationTraversal.java
new file mode 100644
index 0000000..0c1e999
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/ConfigurationTraversal.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.process.computer.util;
+
+
+import org.apache.commons.configuration.Configuration;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+
+import java.util.function.Function;
+import java.util.function.Supplier;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class ConfigurationTraversal<S, E> implements Supplier<Traversal.Admin<S, E>> {
+
+    private Function<Graph, Traversal.Admin<S, E>> functionTraversal;
+    private Object configTraversal;
+    private String configKey;
+    private Graph graph;
+
+    public Traversal.Admin<S, E> get() {
+        return this.functionTraversal.apply(this.graph);
+    }
+
+    private ConfigurationTraversal() {
+
+    }
+
+    public void storeState(final Configuration configuration) {
+        if (null == this.configTraversal)
+            throw new IllegalStateException("The " + ConfigurationTraversal.class.getSimpleName() + " does not have a configuration traversal");
+        try {
+            VertexProgramHelper.serialize(this.configTraversal, configuration, this.configKey);   // the traversal can not be serialized (probably because of lambdas). As such, try direct reference.
+        } catch (final IllegalArgumentException e) {
+            configuration.setProperty(this.configKey, this.configTraversal);
+        }
+    }
+
+    public static <S, E> ConfigurationTraversal<S, E> storeState(final Object traversalConfigObject, final Configuration configuration, final String configKey) {
+        final ConfigurationTraversal<S, E> configurationTraversal = new ConfigurationTraversal<>();
+        configurationTraversal.configKey = configKey;
+        configurationTraversal.configTraversal = traversalConfigObject;
+        configurationTraversal.storeState(configuration);
+        return configurationTraversal;
+    }
+
+    public static <S, E> ConfigurationTraversal<S, E> loadState(final Graph graph, final Configuration configuration, final String configKey) {
+        final ConfigurationTraversal<S, E> configurationTraversal = new ConfigurationTraversal<>();
+        configurationTraversal.graph = graph;
+        configurationTraversal.configKey = configKey;
+        final Object configValue = configuration.getProperty(configKey);
+        configurationTraversal.configTraversal = configValue instanceof String ? VertexProgramHelper.deserialize(configuration, configKey) : (Function<Graph, Traversal.Admin<S, E>>) configValue;
+        if (configurationTraversal.configTraversal instanceof Class) {
+            try {
+                configurationTraversal.functionTraversal = ((Class<Function<Graph, Traversal.Admin<S, E>>>) configurationTraversal.configTraversal).newInstance();
+            } catch (final Exception e) {
+                throw new IllegalStateException(e.getMessage(), e);
+            }
+        } else {
+            configurationTraversal.functionTraversal = (Function<Graph, Traversal.Admin<S, E>>) configurationTraversal.configTraversal;
+        }
+        return configurationTraversal;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/80e511c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/LambdaHolder.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/LambdaHolder.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/LambdaHolder.java
deleted file mode 100644
index d93d10c..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/LambdaHolder.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.computer.util;
-
-
-import org.apache.commons.configuration.Configuration;
-
-import java.util.function.Supplier;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class LambdaHolder<S> implements Supplier<S> {
-
-    public enum Type {
-        OBJECT,
-        SERIALIZED_OBJECT,
-        CLASS,
-        SCRIPT
-    }
-
-    private Type type;
-    private Object configObject;
-    private Object realObject;
-    private String configKeyPrefix;
-
-    private static final String DOT_TYPE = ".type";
-    private static final String DOT_OBJECT = ".object";
-
-
-    public S get() {
-        return (S) this.realObject;
-    }
-
-    private LambdaHolder() {
-
-    }
-
-    public static <T> LambdaHolder<T> storeState(final Configuration configuration, final Type type, final String configKeyPrefix, final Object configObject) {
-        if (type.equals(Type.SCRIPT) && !(configObject instanceof String[]))
-            throw new IllegalArgumentException("Script lambda types must have a String[] configuration object");
-        if (type.equals(Type.CLASS) && !(configObject instanceof Class))
-            throw new IllegalArgumentException("Class lambda types must have a Class configuration object");
-
-        final LambdaHolder<T> lambdaHolder = new LambdaHolder<>();
-        lambdaHolder.type = type;
-        lambdaHolder.configKeyPrefix = configKeyPrefix;
-        lambdaHolder.configObject = configObject;
-        lambdaHolder.storeState(configuration);
-        return lambdaHolder;
-    }
-
-    public static <T> LambdaHolder<T> loadState(final Configuration configuration, final String configKeyPrefix) {
-        if (!configuration.containsKey(configKeyPrefix.concat(DOT_TYPE)))
-            return null;
-        if (!configuration.containsKey(configKeyPrefix.concat(DOT_OBJECT)))
-            return null;
-
-        final LambdaHolder<T> lambdaHolder = new LambdaHolder<>();
-        lambdaHolder.configKeyPrefix = configKeyPrefix;
-        lambdaHolder.type = Type.valueOf(configuration.getString(lambdaHolder.configKeyPrefix.concat(DOT_TYPE)));
-        if (lambdaHolder.type.equals(Type.OBJECT)) {
-            lambdaHolder.configObject = configuration.getProperty(lambdaHolder.configKeyPrefix.concat(DOT_OBJECT));
-            lambdaHolder.realObject = lambdaHolder.configObject;
-        } else if (lambdaHolder.type.equals(Type.SERIALIZED_OBJECT)) {
-            lambdaHolder.configObject = VertexProgramHelper.deserialize(configuration, lambdaHolder.configKeyPrefix.concat(DOT_OBJECT));
-            lambdaHolder.realObject = lambdaHolder.configObject;
-        } else if (lambdaHolder.type.equals(Type.CLASS)) {
-            try {
-                final Class klass = (Class) Class.forName(configuration.getString(lambdaHolder.configKeyPrefix.concat(DOT_OBJECT)));
-                lambdaHolder.configObject = klass;
-                lambdaHolder.realObject = klass.newInstance();
-            } catch (final Exception e) {
-                throw new IllegalStateException(e.getMessage(), e);
-            }
-        } else { // SCRIPT
-            final String[] script = VertexProgramHelper.deserialize(configuration, lambdaHolder.configKeyPrefix.concat(DOT_OBJECT));
-            lambdaHolder.configObject = script;
-            lambdaHolder.realObject = new ScriptEngineLambda(script[0], script[1]);
-        }
-        return lambdaHolder;
-    }
-
-
-    public void storeState(final Configuration configuration) {
-        configuration.setProperty(this.configKeyPrefix.concat(DOT_TYPE), this.type.name());
-        if (this.type.equals(Type.OBJECT))
-            configuration.setProperty(this.configKeyPrefix.concat(DOT_OBJECT), this.configObject);
-        else if (this.type.equals(Type.SERIALIZED_OBJECT))
-            VertexProgramHelper.serialize(this.configObject, configuration, this.configKeyPrefix.concat(DOT_OBJECT));
-        else if (this.type.equals(Type.CLASS))
-            configuration.setProperty(this.configKeyPrefix.concat(DOT_OBJECT), ((Class) this.configObject).getCanonicalName());
-        else   // SCRIPT
-            VertexProgramHelper.serialize(this.configObject, configuration, this.configKeyPrefix.concat(DOT_OBJECT));
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/80e511c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/ShellGraph.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/ShellGraph.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/ShellGraph.java
deleted file mode 100644
index 2a0cbb3..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/ShellGraph.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- *
- *  * Licensed to the Apache Software Foundation (ASF) under one
- *  * or more contributor license agreements.  See the NOTICE file
- *  * distributed with this work for additional information
- *  * regarding copyright ownership.  The ASF licenses this file
- *  * to you under the Apache License, Version 2.0 (the
- *  * "License"); you may not use this file except in compliance
- *  * with the License.  You may obtain a copy of the License at
- *  *
- *  * http://www.apache.org/licenses/LICENSE-2.0
- *  *
- *  * Unless required by applicable law or agreed to in writing,
- *  * software distributed under the License is distributed on an
- *  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  * KIND, either express or implied.  See the License for the
- *  * specific language governing permissions and limitations
- *  * under the License.
- *
- */
-
-package org.apache.tinkerpop.gremlin.process.computer.util;
-
-import org.apache.commons.configuration.BaseConfiguration;
-import org.apache.commons.configuration.Configuration;
-import org.apache.tinkerpop.gremlin.process.computer.ComputerResult;
-import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
-import org.apache.tinkerpop.gremlin.process.computer.MapReduce;
-import org.apache.tinkerpop.gremlin.process.computer.VertexProgram;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.Transaction;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.concurrent.Future;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class ShellGraph implements Graph, Serializable {
-
-    private final Class<? extends Graph> graphClass;
-    public static final String SHELL_GRAPH_CLASS = "shell.graphClass";
-
-    private ShellGraph(final Class<? extends Graph> graphClass) {
-        this.graphClass = graphClass;
-    }
-
-    @Override
-    public Vertex addVertex(final Object... keyValues) {
-        throw Exceptions.vertexAdditionsNotSupported();
-    }
-
-    @Override
-    public <C extends GraphComputer> C compute(final Class<C> graphComputerClass) throws IllegalArgumentException {
-        return (C) ShellGraphComputer.instance();
-    }
-
-    @Override
-    public GraphComputer compute() throws IllegalArgumentException {
-        return ShellGraphComputer.instance();
-    }
-
-    @Override
-    public Iterator<Vertex> vertices(final Object... vertexIds) {
-        return Collections.emptyIterator();
-    }
-
-    @Override
-    public Iterator<Edge> edges(final Object... edgeIds) {
-        return Collections.emptyIterator();
-    }
-
-    @Override
-    public Transaction tx() {
-        throw Exceptions.transactionsNotSupported();
-    }
-
-    @Override
-    public Variables variables() {
-        throw Exceptions.variablesNotSupported();
-    }
-
-    @Override
-    public Configuration configuration() {
-        final Configuration configuration = new BaseConfiguration();
-        configuration.setProperty(Graph.GRAPH, ShellGraph.class.getName());
-        configuration.setProperty(SHELL_GRAPH_CLASS, this.graphClass);
-        return configuration;
-    }
-
-    @Override
-    public void close() throws Exception {
-
-    }
-
-    public Class<? extends Graph> getGraphClass() {
-        return this.graphClass;
-    }
-
-    public static ShellGraph open(final Configuration configuration) {
-        return new ShellGraph((Class<? extends Graph>) configuration.getProperty(SHELL_GRAPH_CLASS));
-    }
-
-    public static ShellGraph of(final Class<? extends Graph> graphClass) {
-        return new ShellGraph(graphClass);
-    }
-
-    private static class ShellGraphComputer implements GraphComputer {
-
-        private static final ShellGraphComputer INSTANCE = new ShellGraphComputer();
-
-        @Override
-        public GraphComputer isolation(final Isolation isolation) {
-            return this;
-        }
-
-        @Override
-        public GraphComputer result(final ResultGraph resultGraph) {
-            return this;
-        }
-
-        @Override
-        public GraphComputer persist(final Persist persist) {
-            return this;
-        }
-
-        @Override
-        public GraphComputer program(final VertexProgram vertexProgram) {
-            return this;
-        }
-
-        @Override
-        public GraphComputer mapReduce(final MapReduce mapReduce) {
-            return this;
-        }
-
-        @Override
-        public Future<ComputerResult> submit() {
-            throw new UnsupportedOperationException(ShellGraphComputer.class.getCanonicalName() + " can not be executed as it is simply a placeholder");
-        }
-
-        public static ShellGraphComputer instance() {
-            return INSTANCE;
-        }
-    }
-
-    public class Features implements Graph.Features {
-
-        @Override
-        public GraphFeatures graph() {
-            return new GraphFeatures() {
-                @Override
-                public boolean supportsComputer() {
-                    return true;
-                }
-
-                @Override
-                public boolean supportsPersistence() {
-                    return false;
-                }
-
-                @Override
-                public boolean supportsTransactions() {
-                    return false;
-                }
-
-                @Override
-                public boolean supportsThreadedTransactions() {
-                    return false;
-                }
-
-                @Override
-                public VariableFeatures variables() {
-                    return new VariableFeatures() {
-                        @Override
-                        public boolean supportsVariables() {
-                            return false;
-                        }
-                    };
-                }
-            };
-        }
-
-        @Override
-        public VertexFeatures vertex() {
-            return new VertexFeatures() {
-                @Override
-                public boolean supportsAddVertices() {
-                    return false;
-                }
-
-                @Override
-                public boolean supportsRemoveVertices() {
-                    return false;
-                }
-
-                @Override
-                public boolean supportsMultiProperties() {
-                    return false;
-                }
-
-                @Override
-                public boolean supportsMetaProperties() {
-                    return false;
-                }
-
-                @Override
-                public VertexPropertyFeatures properties() {
-                    return new VertexPropertyFeatures() {
-                        @Override
-                        public boolean supportsAddProperty() {
-                            return false;
-                        }
-
-                        @Override
-                        public boolean supportsRemoveProperty() {
-                            return false;
-                        }
-
-                        @Override
-                        public boolean supportsUserSuppliedIds() {
-                            return false;
-                        }
-
-                        @Override
-                        public boolean supportsNumericIds() {
-                            return false;
-                        }
-
-                        @Override
-                        public boolean supportsStringIds() {
-                            return false;
-                        }
-
-                        @Override
-                        public boolean supportsUuidIds() {
-                            return false;
-                        }
-
-                        @Override
-                        public boolean supportsCustomIds() {
-                            return false;
-                        }
-
-                        @Override
-                        public boolean supportsAnyIds() {
-                            return false;
-                        }
-                    };
-                }
-            };
-        }
-
-        @Override
-        public EdgeFeatures edge() {
-            return new EdgeFeatures() {
-                @Override
-                public boolean supportsAddEdges() {
-                    return false;
-                }
-
-                @Override
-                public boolean supportsRemoveEdges() {
-                    return false;
-                }
-
-                @Override
-                public EdgePropertyFeatures properties() {
-                    return new EdgePropertyFeatures() {
-                        @Override
-                        public boolean supportsProperties() {
-                            return false;
-                        }
-                    };
-                }
-            };
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/80e511c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
index 99cfb93..179f967 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
@@ -18,7 +18,6 @@
  */
 package org.apache.tinkerpop.gremlin.process.traversal;
 
-import org.apache.tinkerpop.gremlin.process.computer.util.ShellGraph;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.ConjunctionStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization.EngineDependentStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization.ProfileStrategy;
@@ -216,10 +215,6 @@ public interface TraversalStrategies extends Serializable, Cloneable {
             }
             return traversalStrategies;
         }
-
-        public static Class<? extends Graph> getGraphClass(final Graph graph) {
-            return graph instanceof ShellGraph ? ((ShellGraph) graph).getGraphClass() : graph.getClass();
-        }
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/80e511c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
index 401ae92..c6e3baa 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
@@ -74,7 +74,7 @@ public class GraphTraversalSource implements TraversalSource {
         this.withoutStrategies = withoutStrategies;
         this.withStrategies.addAll(engineBuilder.getWithStrategies());
         this.withoutStrategies.addAll(engineBuilder.getWithoutStrategies());
-        final TraversalStrategies tempStrategies = TraversalStrategies.GlobalCache.getStrategies(TraversalStrategies.GlobalCache.getGraphClass(this.graph));
+        final TraversalStrategies tempStrategies = TraversalStrategies.GlobalCache.getStrategies(this.graph.getClass());
         this.strategies = withStrategies.isEmpty() && withoutStrategies.isEmpty() ?
                 tempStrategies :
                 tempStrategies.clone()

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/80e511c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ComputerAwareStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ComputerAwareStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ComputerAwareStep.java
index 7dcdc70..098ca58 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ComputerAwareStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ComputerAwareStep.java
@@ -57,7 +57,7 @@ public abstract class ComputerAwareStep<S, E> extends AbstractStep<S, E> impleme
     @Override
     public ComputerAwareStep<S, E> clone() {
         final ComputerAwareStep<S, E> clone = (ComputerAwareStep<S, E>) super.clone();
-        clone.previousIterator = Collections.emptyIterator();
+        clone.previousIterator = EmptyIterator.instance();
         return clone;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/80e511c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ReducingBarrierStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ReducingBarrierStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ReducingBarrierStep.java
index 90f2182..078b583 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ReducingBarrierStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ReducingBarrierStep.java
@@ -129,7 +129,8 @@ public abstract class ReducingBarrierStep<S, E> extends AbstractStep<S, E> imple
 
         }
 
-        public void loadState(final Configuration configuration) {
+        @Override
+        public void loadState(final Graph graph, final Configuration configuration) {
             this.seedSupplier = VertexProgramHelper.deserialize(configuration, REDUCING_BARRIER_STEP_SEED_SUPPLIER);
             this.biFunction = VertexProgramHelper.deserialize(configuration, REDUCING_BARRIER_STEP_BI_FUNCTION);
         }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/80e511c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversal.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversal.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversal.java
index 92572a6..3415931 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversal.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversal.java
@@ -56,7 +56,7 @@ public class DefaultTraversal<S, E> implements Traversal.Admin<S, E> {
     public DefaultTraversal() {
         this.graph = null;
         // necessary for anonymous traversals without a graph start (rethink how this works in the future)
-        this.setStrategies(TraversalStrategies.GlobalCache.getStrategies(TraversalStrategies.GlobalCache.getGraphClass(EmptyGraph.instance())));
+        this.setStrategies(TraversalStrategies.GlobalCache.getStrategies(EmptyGraph.class));
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/80e511c7/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/computer/ComputerTestHelper.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/computer/ComputerTestHelper.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/computer/ComputerTestHelper.groovy
index ff34c91..c054fc8 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/computer/ComputerTestHelper.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/computer/ComputerTestHelper.groovy
@@ -29,19 +29,19 @@ import org.apache.tinkerpop.gremlin.structure.Graph
  */
 public class ComputerTestHelper {
 
-    public static final Traversal compute(
+    public static final Traversal.Admin<?,?> compute(
             final Graph graph,
             final TraversalSource.Builder builder,
             final String scriptEngineName,
             final String traversalScript,
             final Object... bindings) {
 
-        final TraversalVertexProgram program = TraversalVertexProgram.build().traversal(graph.getClass(), builder, scriptEngineName, traversalScript, bindings).create();
+        final TraversalVertexProgram program = TraversalVertexProgram.build().traversal(builder, scriptEngineName, traversalScript, bindings).create(graph);
         final ComputerResult result = builder.create(graph).getGraphComputer().get().program(program).submit().get();
         return program.computerResultTraversal(result);
     }
 
-    public static final Traversal compute(final String script, final GraphTraversalSource g, final Object... bindings) {
+    public static final <S,E> Traversal.Admin<S,E> compute(final String script, final GraphTraversalSource g, final Object... bindings) {
         return ComputerTestHelper.compute(g.getGraph().get(), g.asBuilder(), "gremlin-groovy", script, bindings);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/80e511c7/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/groovy/plugin/HadoopRemoteAcceptor.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/groovy/plugin/HadoopRemoteAcceptor.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/groovy/plugin/HadoopRemoteAcceptor.java
index c3f14ff..704ef1a 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/groovy/plugin/HadoopRemoteAcceptor.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/groovy/plugin/HadoopRemoteAcceptor.java
@@ -100,7 +100,7 @@ public class HadoopRemoteAcceptor implements RemoteAcceptor {
             String script = RemoteAcceptor.getScript(String.join(SPACE, args), this.shell);
             if (this.useSugarPlugin)
                 script = SugarLoader.class.getPackage() + ".SugarLoader.load()\n" + script;
-            final TraversalVertexProgram program = TraversalVertexProgram.build().traversal(this.hadoopGraph.getClass(), GraphTraversalSource.computer(), "gremlin-groovy", script).create(this.hadoopGraph);
+            final TraversalVertexProgram program = TraversalVertexProgram.build().traversal(GraphTraversalSource.computer(), "gremlin-groovy", script).create(this.hadoopGraph);
             final ComputerResult computerResult = this.hadoopGraph.compute().program(program).submit().get();
             this.shell.getInterp().getContext().setProperty(RESULT, computerResult);
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/80e511c7/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/example/TraversalSupplier1.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/example/TraversalSupplier1.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/example/TraversalSupplier1.java
index f5d19c2..1631ca8 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/example/TraversalSupplier1.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/example/TraversalSupplier1.java
@@ -18,18 +18,18 @@
  */
 package org.apache.tinkerpop.gremlin.hadoop.process.computer.example;
 
-import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph;
-import org.apache.tinkerpop.gremlin.process.computer.util.ShellGraph;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
 
-import java.util.function.Supplier;
+import java.util.function.Function;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
  */
-public class TraversalSupplier1 implements Supplier<Traversal> {
+public class TraversalSupplier1 implements Function<Graph, Traversal<Vertex, String>> {
     @Override
-    public Traversal get() {
-        return ShellGraph.of(HadoopGraph.class).traversal().V().out().out().values("name");
+    public Traversal<Vertex, String> apply(final Graph graph) {
+        return graph.traversal().V().out().out().values("name");
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/80e511c7/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/example/TraversalSupplier2.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/example/TraversalSupplier2.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/example/TraversalSupplier2.java
index 7636495..b3366c5 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/example/TraversalSupplier2.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/example/TraversalSupplier2.java
@@ -19,7 +19,6 @@
 package org.apache.tinkerpop.gremlin.hadoop.process.computer.example;
 
 import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph;
-import org.apache.tinkerpop.gremlin.process.computer.util.ShellGraph;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 
 import java.util.function.Supplier;
@@ -30,6 +29,6 @@ import java.util.function.Supplier;
 public class TraversalSupplier2 implements Supplier<Traversal> {
     @Override
     public Traversal get() {
-        return ShellGraph.of(HadoopGraph.class).traversal().V().<String>values("name").map(s -> s.get().length()).groupCount().<Integer>by(i -> i + 100);
+        return HadoopGraph.open().traversal().V().<String>values("name").map(s -> s.get().length()).groupCount().<Integer>by(i -> i + 100);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/80e511c7/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/example/TraversalSupplier3.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/example/TraversalSupplier3.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/example/TraversalSupplier3.java
index 296937f..a1c0ecb 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/example/TraversalSupplier3.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/example/TraversalSupplier3.java
@@ -19,7 +19,6 @@
 package org.apache.tinkerpop.gremlin.hadoop.process.computer.example;
 
 import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph;
-import org.apache.tinkerpop.gremlin.process.computer.util.ShellGraph;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 
 import java.util.Collection;
@@ -31,6 +30,6 @@ import java.util.function.Supplier;
 public class TraversalSupplier3 implements Supplier<Traversal> {
     @Override
     public Traversal get() {
-        return ShellGraph.of(HadoopGraph.class).traversal().V().<String>values("name").group().<String>by(s -> s.substring(1, 2)).by(v -> v).<Collection>by(Collection::size);
+        return HadoopGraph.open().traversal().V().<String>values("name").group().<String>by(s -> s.substring(1, 2)).by(v -> v).<Collection>by(Collection::size);
     }
 }