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 2016/06/30 15:49:27 UTC

[1/8] tinkerpop git commit: Improved performance of TinkerGraph around element lookup.

Repository: tinkerpop
Updated Branches:
  refs/heads/master 44ad2ebdc -> 78f7f3e50


Improved performance of TinkerGraph around element lookup.

Primary change was to drop use of Stream and use IteratorUtils.


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

Branch: refs/heads/master
Commit: 70dd3245eadcf2dd69720c50fbffd3b0c9e92922
Parents: 84f2d63
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Dec 22 16:43:45 2015 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jun 16 14:19:23 2016 -0400

----------------------------------------------------------------------
 .../step/sideEffect/TinkerGraphStep.java        | 15 +++++-----
 .../tinkergraph/structure/TinkerGraph.java      | 31 ++++++++++++--------
 2 files changed, 27 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/70dd3245/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/step/sideEffect/TinkerGraphStep.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/step/sideEffect/TinkerGraphStep.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/step/sideEffect/TinkerGraphStep.java
index b0a5714..3ec73c3 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/step/sideEffect/TinkerGraphStep.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/step/sideEffect/TinkerGraphStep.java
@@ -28,6 +28,7 @@ import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerHelper;
+import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -79,17 +80,17 @@ public final class TinkerGraphStep<S, E extends Element> extends GraphStep<S, E>
         else
             return null == indexedContainer ?
                     this.iteratorList(graph.vertices()) :
-                    TinkerHelper.queryVertexIndex(graph, indexedContainer.getKey(), indexedContainer.getPredicate().getValue()).stream()
-                            .filter(vertex -> HasContainer.testAll(vertex, this.hasContainers))
-                            .collect(Collectors.<Vertex>toList()).iterator();
+                    IteratorUtils.filter(TinkerHelper.queryVertexIndex(graph, indexedContainer.getKey(), indexedContainer.getPredicate().getValue()).iterator(),
+                            vertex -> HasContainer.testAll(vertex, this.hasContainers));
     }
 
     private HasContainer getIndexKey(final Class<? extends Element> indexedClass) {
         final Set<String> indexedKeys = ((TinkerGraph) this.getTraversal().getGraph().get()).getIndexedKeys(indexedClass);
-        return this.hasContainers.stream()
-                .filter(c -> indexedKeys.contains(c.getKey()) && c.getPredicate().getBiPredicate() == Compare.eq)
-                .findAny()
-                .orElseGet(() -> null);
+
+        final Iterator<HasContainer> itty = IteratorUtils.filter(hasContainers.iterator(),
+                c -> c.getPredicate().getBiPredicate() == Compare.eq && indexedKeys.contains(c.getKey()));
+        return itty.hasNext() ? itty.next() : null;
+
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/70dd3245/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
index 35e268e..168dd7f 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
@@ -36,11 +36,13 @@ import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 import org.apache.tinkerpop.gremlin.tinkergraph.process.computer.TinkerGraphComputer;
 import org.apache.tinkerpop.gremlin.tinkergraph.process.computer.TinkerGraphComputerView;
 import org.apache.tinkerpop.gremlin.tinkergraph.process.traversal.strategy.optimization.TinkerGraphStepStrategy;
+import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
 
 import java.io.File;
-import java.io.IOException;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
@@ -317,31 +319,36 @@ public final class TinkerGraph implements Graph {
         }
     }
 
-
-
     private <T extends Element> Iterator<T> createElementIterator(final Class<T> clazz, final Map<Object, T> elements,
                                                                   final IdManager idManager,
                                                                   final Object... ids) {
         if (0 == ids.length) {
             return elements.values().iterator();
         } else {
+            final List<Object> idList = Arrays.asList(ids);
             // base the conversion function on the first item in the id list as the expectation is that these
             // id values will be a uniform list
             if (clazz.isAssignableFrom(ids[0].getClass())) {
-                // based on the first item assume all vertices in the argument list
-                if (!Stream.of(ids).allMatch(id -> clazz.isAssignableFrom(id.getClass())))
-                    throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();
-
-                // got a bunch of Elements - have to look each upup because it might be an Attachable instance or
+                // got a bunch of Elements - have to look each up because it might be an Attachable instance or
                 // other implementation. the assumption is that id conversion is not required for detached
                 // stuff - doesn't seem likely someone would detach a Titan vertex then try to expect that
                 // vertex to be findable in OrientDB
-                return Stream.of(ids).map(id -> elements.get(((T) id).id())).filter(Objects::nonNull).iterator();
+                return IteratorUtils.filter(IteratorUtils.map(idList, id -> {
+                    // based on the first item assume all vertices in the argument list
+                    if (!clazz.isAssignableFrom(id.getClass()))
+                        throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();
+
+                    return elements.get(clazz.cast(id).id());
+                }).iterator(), Objects::nonNull);
             } else {
                 final Class<?> firstClass = ids[0].getClass();
-                if (!Stream.of(ids).map(Object::getClass).allMatch(firstClass::equals))
-                    throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();
-                return Stream.of(ids).map(id -> idManager.convert(id)).map(elements::get).filter(Objects::nonNull).iterator();
+                return IteratorUtils.filter(IteratorUtils.map(idList, id -> {
+                    // all items in the list should be of the same class - don't get fancy on a Graph
+                    if (!id.getClass().equals(firstClass))
+                        throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();
+
+                    return elements.get(idManager.convert(id));
+                }).iterator(), Objects::nonNull);
             }
         }
     }


[2/8] tinkerpop git commit: Made TinkerGraph validate that ids be homogeneous up front.

Posted by sp...@apache.org.
Made TinkerGraph validate that ids be homogeneous up front.

Take this approach rather than doing it during iteration so that TinkerPop semantics are respected and appropriate validation exceptions are thrown at the right time.


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

Branch: refs/heads/master
Commit: e59b93ca4ec7ffbde4a4b91319f35f5d3fd9caeb
Parents: 70dd324
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jun 16 15:08:30 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jun 16 15:08:30 2016 -0400

----------------------------------------------------------------------
 .../tinkergraph/structure/TinkerGraph.java      | 41 ++++++++------------
 1 file changed, 17 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e59b93ca/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
index 168dd7f..edffab9 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
@@ -326,30 +326,15 @@ public final class TinkerGraph implements Graph {
             return elements.values().iterator();
         } else {
             final List<Object> idList = Arrays.asList(ids);
-            // base the conversion function on the first item in the id list as the expectation is that these
-            // id values will be a uniform list
-            if (clazz.isAssignableFrom(ids[0].getClass())) {
-                // got a bunch of Elements - have to look each up because it might be an Attachable instance or
-                // other implementation. the assumption is that id conversion is not required for detached
-                // stuff - doesn't seem likely someone would detach a Titan vertex then try to expect that
-                // vertex to be findable in OrientDB
-                return IteratorUtils.filter(IteratorUtils.map(idList, id -> {
-                    // based on the first item assume all vertices in the argument list
-                    if (!clazz.isAssignableFrom(id.getClass()))
-                        throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();
-
-                    return elements.get(clazz.cast(id).id());
-                }).iterator(), Objects::nonNull);
-            } else {
-                final Class<?> firstClass = ids[0].getClass();
-                return IteratorUtils.filter(IteratorUtils.map(idList, id -> {
-                    // all items in the list should be of the same class - don't get fancy on a Graph
-                    if (!id.getClass().equals(firstClass))
-                        throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();
-
-                    return elements.get(idManager.convert(id));
-                }).iterator(), Objects::nonNull);
-            }
+            validateHomogenousIds(idList);
+
+            // if the type is of Element - have to look each up because it might be an Attachable instance or
+            // other implementation. the assumption is that id conversion is not required for detached
+            // stuff - doesn't seem likely someone would detach a Titan vertex then try to expect that
+            // vertex to be findable in OrientDB
+            return clazz.isAssignableFrom(ids[0].getClass()) ?
+               IteratorUtils.filter(IteratorUtils.map(idList, id -> elements.get(clazz.cast(id).id())).iterator(), Objects::nonNull)
+                : IteratorUtils.filter(IteratorUtils.map(idList, id -> elements.get(idManager.convert(id))).iterator(), Objects::nonNull);
         }
     }
 
@@ -365,6 +350,14 @@ public final class TinkerGraph implements Graph {
         return features;
     }
 
+    private void validateHomogenousIds(final List<Object> ids) {
+        final Class firstClass = ids.get(0).getClass();
+        for (Object id : ids) {
+            if (!id.getClass().equals(firstClass))
+                throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();
+        }
+    }
+
     public class TinkerGraphFeatures implements Features {
 
         private final TinkerGraphGraphFeatures graphFeatures = new TinkerGraphGraphFeatures();


[3/8] tinkerpop git commit: Updated changelog.

Posted by sp...@apache.org.
Updated changelog.


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

Branch: refs/heads/master
Commit: 099e6bc62468516974a3e76531d00444dbe89edc
Parents: e59b93c
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jun 16 15:32:58 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jun 16 15:32:58 2016 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/099e6bc6/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index a359eca..2ae2e77 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -30,6 +30,7 @@ TinkerPop 3.1.3 (NOT OFFICIALLY RELEASED YET)
 * Fixed bug in `SubgraphStrategy` where step labels were not being propogated properly to new steps injected by the strategy.
 * Defaulted to `Edge.DEFAULT` if no edge label was supplied in GraphML.
 * Fixed bug in `IoGraphTest` causing IllegalArgumentException: URI is not hierarchical error for external graph implementations.
+* Improved `TinkerGraph` performance when iterating vertices and edges.
 * Fixed a bug where timeout functions provided to the `GremlinExecutor` were not executing in the same thread as the script evaluation.
 * Optimized a few special cases in `RangeByIsCountStrategy`.
 * Named the thread pool used by Gremlin Server sessions: "gremlin-server-session-$n".


[8/8] tinkerpop git commit: Merge remote-tracking branch 'origin/tp31'

Posted by sp...@apache.org.
Merge remote-tracking branch 'origin/tp31'

Conflicts:
	tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java


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

Branch: refs/heads/master
Commit: 78f7f3e506ec18fe2d61ad3dbc0a015854c353fb
Parents: 44ad2eb 1c9bd08
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jun 30 11:49:15 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jun 30 11:49:15 2016 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 .../gremlin/groovy/engine/GremlinExecutor.java  |  2 +-
 .../step/sideEffect/TinkerGraphStep.java        | 15 +++----
 .../tinkergraph/structure/TinkerGraph.java      | 44 +++++++++++---------
 4 files changed, 35 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/78f7f3e5/CHANGELOG.asciidoc
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/78f7f3e5/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/step/sideEffect/TinkerGraphStep.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/78f7f3e5/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
----------------------------------------------------------------------
diff --cc tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
index 73a4205,af7245a..4cf264e
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
@@@ -320,35 -322,20 +322,26 @@@ public final class TinkerGraph implemen
      private <T extends Element> Iterator<T> createElementIterator(final Class<T> clazz, final Map<Object, T> elements,
                                                                    final IdManager idManager,
                                                                    final Object... ids) {
 +        final Iterator<T> iterator;
          if (0 == ids.length) {
 -            return elements.values().iterator();
 +            iterator = elements.values().iterator();
          } else {
-             // base the conversion function on the first item in the id list as the expectation is that these
-             // id values will be a uniform list
-             if (clazz.isAssignableFrom(ids[0].getClass())) {
-                 // based on the first item assume all vertices in the argument list
-                 if (!Stream.of(ids).allMatch(id -> clazz.isAssignableFrom(id.getClass())))
-                     throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();
- 
-                 // got a bunch of Elements - have to look each upup because it might be an Attachable instance or
-                 // other implementation. the assumption is that id conversion is not required for detached
-                 // stuff - doesn't seem likely someone would detach a Titan vertex then try to expect that
-                 // vertex to be findable in OrientDB
-                 iterator = Stream.of(ids).map(id -> elements.get(((T) id).id())).filter(Objects::nonNull).iterator();
-             } else {
-                 final Class<?> firstClass = ids[0].getClass();
-                 if (!Stream.of(ids).map(Object::getClass).allMatch(firstClass::equals))
-                     throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();
-                 iterator = Stream.of(ids).map(id -> idManager.convert(id)).map(elements::get).filter(Objects::nonNull).iterator();
-             }
+             final List<Object> idList = Arrays.asList(ids);
+             validateHomogenousIds(idList);
+ 
+             // if the type is of Element - have to look each up because it might be an Attachable instance or
+             // other implementation. the assumption is that id conversion is not required for detached
+             // stuff - doesn't seem likely someone would detach a Titan vertex then try to expect that
+             // vertex to be findable in OrientDB
+             return clazz.isAssignableFrom(ids[0].getClass()) ?
+                IteratorUtils.filter(IteratorUtils.map(idList, id -> elements.get(clazz.cast(id).id())).iterator(), Objects::nonNull)
+                 : IteratorUtils.filter(IteratorUtils.map(idList, id -> elements.get(idManager.convert(id))).iterator(), Objects::nonNull);
          }
 +        return TinkerHelper.inComputerMode(this) ?
 +                (Iterator<T>) (clazz.equals(Vertex.class) ?
 +                        IteratorUtils.filter((Iterator<Vertex>) iterator, t -> this.graphComputerView.legalVertex(t)) :
 +                        IteratorUtils.filter((Iterator<Edge>) iterator, t -> this.graphComputerView.legalEdge(t.outVertex(), t))) :
 +                iterator;
      }
  
      /**


[7/8] tinkerpop git commit: Merge remote-tracking branch 'origin/TINKERPOP-1063' into tp31

Posted by sp...@apache.org.
Merge remote-tracking branch 'origin/TINKERPOP-1063' into tp31


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

Branch: refs/heads/master
Commit: 1c9bd087d54a1f7a6506edacd34e07d713d15a04
Parents: d699cb6 1e0c581
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jun 30 11:22:46 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jun 30 11:22:46 2016 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 .../step/sideEffect/TinkerGraphStep.java        | 15 ++++---
 .../tinkergraph/structure/TinkerGraph.java      | 47 +++++++++++---------
 3 files changed, 35 insertions(+), 28 deletions(-)
----------------------------------------------------------------------



[5/8] tinkerpop git commit: Cancellation of a timeout should occur in existing thread pool

Posted by sp...@apache.org.
Cancellation of a timeout should occur in existing thread pool

Prior to this change, the cancellation of a timeout occured in the ForkJoinPool when an existing thread pool in the GremlinExecutor was present to handle that job. CTR


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

Branch: refs/heads/master
Commit: d699cb6c00ccef02a7b93948cf185a61481dc12b
Parents: 8c04d61
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Jun 28 13:59:36 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Jun 28 13:59:36 2016 -0400

----------------------------------------------------------------------
 .../apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d699cb6c/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
index 2476114..63721eb 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
@@ -310,7 +310,7 @@ public class GremlinExecutor implements AutoCloseable {
             evaluationFuture.handleAsync((v, t) -> {
                 logger.debug("Killing scheduled timeout on script evaluation as the eval completed (possibly with exception).");
                 return sf.cancel(true);
-            });
+            }, scheduledExecutorService);
         }
 
         return evaluationFuture;


[4/8] tinkerpop git commit: removed NOTE: Neo4jGraph currently does not support HA and added an image for the HA section. CTR.

Posted by sp...@apache.org.
removed NOTE: Neo4jGraph currently does not support HA and added an image for the HA section. CTR.

(cherry picked from commit da26cf1862b7827223205c5410731c96d3cca70a)


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

Branch: refs/heads/master
Commit: 8c04d617e90bc374764b06d502e2fc50c89335a8
Parents: 45e19af
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Fri Jun 17 07:33:37 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Fri Jun 17 08:16:05 2016 -0600

----------------------------------------------------------------------
 docs/src/reference/implementations-neo4j.asciidoc |   5 +----
 docs/static/images/neo4j-ha.png                   | Bin 0 -> 108249 bytes
 2 files changed, 1 insertion(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8c04d617/docs/src/reference/implementations-neo4j.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/implementations-neo4j.asciidoc b/docs/src/reference/implementations-neo4j.asciidoc
index 998eb74..d1fc30b 100644
--- a/docs/src/reference/implementations-neo4j.asciidoc
+++ b/docs/src/reference/implementations-neo4j.asciidoc
@@ -54,9 +54,6 @@ gremlin> graph = Neo4jGraph.open('/tmp/neo4j')
 ==>neo4jgraph[EmbeddedGraphDatabase [/tmp/neo4j]]
 ----
 
-NOTE: Neo4j link:http://docs.neo4j.org/chunked/stable/ha.html[High Availability] is currently not supported by
-Neo4j-Gremlin.
-
 TIP: To host Neo4j in <<gremlin-server,Gremlin Server>>, the dependencies must first be "installed" or otherwise
 copied to the Gremlin Server path. The automated method for doing this would be to execute
 `bin/gremlin-server.sh -i org.apache.tinkerpop neo4j-gremlin x.y.z`.
@@ -263,7 +260,7 @@ gremlin.neo4j.conf.relationship_auto_indexing=true
 High Availability Configuration
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-TinkerPop supports running Neo4j with its fault tolerant master-slave replication configuration, referred to as its
+image:neo4j-ha.png[width=400,float=right] TinkerPop supports running Neo4j with its fault tolerant master-slave replication configuration, referred to as its
 link:http://neo4j.com/docs/operations-manual/current/#_neo4j_cluster_install[High Availability (HA) cluster]. From the
 TinkerPop perspective, configuring for HA is not that different than configuring for embedded mode as shown above. The
 main difference is the usage of HA configuration options that enable the cluster. Once connected to a cluster, usage

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8c04d617/docs/static/images/neo4j-ha.png
----------------------------------------------------------------------
diff --git a/docs/static/images/neo4j-ha.png b/docs/static/images/neo4j-ha.png
new file mode 100644
index 0000000..b21393c
Binary files /dev/null and b/docs/static/images/neo4j-ha.png differ


[6/8] tinkerpop git commit: Removed potential for NPEs when validating IDs given to vertices()/edges()

Posted by sp...@apache.org.
Removed potential for NPEs when validating IDs given to vertices()/edges()


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

Branch: refs/heads/master
Commit: 1e0c581c90b67a44121f8ec7258ea171e7c0bfe7
Parents: 099e6bc
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jun 30 05:48:01 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jun 30 05:48:01 2016 -0400

----------------------------------------------------------------------
 .../gremlin/tinkergraph/structure/TinkerGraph.java       | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1e0c581c/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
index edffab9..af7245a 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
@@ -351,9 +351,14 @@ public final class TinkerGraph implements Graph {
     }
 
     private void validateHomogenousIds(final List<Object> ids) {
-        final Class firstClass = ids.get(0).getClass();
-        for (Object id : ids) {
-            if (!id.getClass().equals(firstClass))
+        final Iterator<Object> iterator = ids.iterator();
+        Object id = iterator.next();
+        if (id == null)
+            throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();
+        final Class firstClass = id.getClass();
+        while (iterator.hasNext()) {
+            id = iterator.next();
+            if (id == null || !id.getClass().equals(firstClass))
                 throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();
         }
     }