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/13 22:15:55 UTC

[2/4] incubator-tinkerpop git commit: Strategies should be local to a context not added to the global strategy cache.

Strategies should be local to a context not added to the global strategy cache.


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

Branch: refs/heads/master
Commit: 25839434729cb1a1fc2237b799e8e855cd1a9edc
Parents: 06b1d6f
Author: Stephen Mallette <sp...@apache.org>
Authored: Fri Mar 13 17:13:44 2015 -0400
Committer: Stephen Mallette <sp...@apache.org>
Committed: Fri Mar 13 17:13:44 2015 -0400

----------------------------------------------------------------------
 .../process/graph/traversal/GraphTraversalContext.java      | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/25839434/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/GraphTraversalContext.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/GraphTraversalContext.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/GraphTraversalContext.java
index bb62078..81f2329 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/GraphTraversalContext.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/GraphTraversalContext.java
@@ -57,7 +57,14 @@ public class GraphTraversalContext implements TraversalContext {
     public GraphTraversalContext(final Graph graph, final TraversalEngine.Builder engine, final TraversalStrategy... strategies) {
         this.graph = graph;
         this.engine = engine;
-        this.strategies = TraversalStrategies.GlobalCache.getStrategies(this.graph.getClass()).addStrategies(strategies);
+        final TraversalStrategies temp = TraversalStrategies.GlobalCache.getStrategies(this.graph.getClass());
+
+        try {
+            this.strategies = strategies.length == 0 ? temp : temp.clone().addStrategies(strategies);
+        } catch (CloneNotSupportedException cnse) {
+            // seems unlikely that this should happen so propogate as a runtime issue.
+            throw new RuntimeException(cnse);
+        }
     }
 
     public GraphTraversal<Vertex, Vertex> V(final Object... vertexIds) {