tinkerpop git commit: TINKERPOP-1642 Made Mutating steps implement Scoping.

2017-03-10 Thread spmallette
Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1642 249a5d36e -> 31551ec0f


TINKERPOP-1642 Made Mutating steps implement Scoping.

This simplified PathUtil.getReferencedLabels() and reduced iterations over 
Parameter traversals.


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

Branch: refs/heads/TINKERPOP-1642
Commit: 31551ec0f3ca8b52e403c8c5a75d754f6a52cbae
Parents: 249a5d3
Author: Stephen Mallette 
Authored: Fri Mar 10 15:11:52 2017 -0500
Committer: Stephen Mallette 
Committed: Fri Mar 10 15:11:52 2017 -0500

--
 CHANGELOG.asciidoc  |  1 +
 .../process/traversal/Parameterizing.java   |  8 +
 .../gremlin/process/traversal/step/Scoping.java | 14 +---
 .../process/traversal/step/map/AddEdgeStep.java | 10 +-
 .../traversal/step/map/AddVertexStartStep.java  |  9 -
 .../traversal/step/map/AddVertexStep.java   |  9 -
 .../step/sideEffect/AddPropertyStep.java|  9 -
 .../process/traversal/step/util/Parameters.java | 37 +---
 .../process/traversal/util/PathUtil.java| 17 +
 9 files changed, 84 insertions(+), 30 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/31551ec0/CHANGELOG.asciidoc
--
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 4f7f0c7..3f2db36 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ 
image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.2.5 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~
 
+* `Mutating` steps now implement `Scoping` interface.
 * `LABELED_PATH` requirement is now set if any step in the traversal is 
labeled.
 * Split `ComputerVerificationStrategy` into two strategies: 
`ComputerVerificationStrategy` and `ComputerFinalizationStrategy`.
 * Removed `HasTest.g_V_hasId_compilationEquality` from process test suite as 
it makes too many assumptions about provider compilation.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/31551ec0/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Parameterizing.java
--
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Parameterizing.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Parameterizing.java
index 8af80b3..9b7e088 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Parameterizing.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Parameterizing.java
@@ -21,9 +21,17 @@ package org.apache.tinkerpop.gremlin.process.traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
 
 /**
+ * An interface for {@link Step} implementations that hold a {@link 
Parameters} object, which fold in arguments from
+ * other steps. It is typically used on mutating steps, such as {@code 
addV()}, where calls to {@code property(k,v)}
+ * are folded in as parameters to that add vertex step.
+ *
  * @author Marko A. Rodriguez (http://markorodriguez.com)
+ * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public interface Parameterizing {
 
+/**
+ * Gets the parameters on the step.
+ */
 public Parameters getParameters();
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/31551ec0/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
--
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
index 22109bf..683e661 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
@@ -20,23 +20,27 @@ package org.apache.tinkerpop.gremlin.process.traversal.step;
 
 import org.apache.tinkerpop.gremlin.process.traversal.Path;
 import org.apache.tinkerpop.gremlin.process.traversal.Pop;
+import org.apache.tinkerpop.gremlin.process.traversal.Step;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
-import 
org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
 
-import java.util.EnumSet;
 import java.util.Map;
 import 

tinkerpop git commit: TINKERPOP-1642 Minor refactoring to get rid of duplicate code

2017-03-10 Thread spmallette
Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1642 103d7f9df -> 249a5d36e


TINKERPOP-1642 Minor refactoring to get rid of duplicate code


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

Branch: refs/heads/TINKERPOP-1642
Commit: 249a5d36ea2e29f26c6495e1130b2f0661133985
Parents: 103d7f9
Author: Stephen Mallette 
Authored: Fri Mar 10 13:27:01 2017 -0500
Committer: Stephen Mallette 
Committed: Fri Mar 10 13:27:01 2017 -0500

--
 .../process/traversal/util/TraversalHelper.java  | 19 ++-
 1 file changed, 10 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/249a5d36/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
--
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
index 5163824..95862d0 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
@@ -417,7 +417,7 @@ public final class TraversalHelper {
  * Determine if any step in {@link Traversal} or its children match the 
step given the provided {@link Predicate}.
  *
  * @param predicate the match function
- * @param traversal th traversal to perform the action on
+ * @param traversal the traversal to perform the action on
  * @return {@code true} if there is a match and {@code false} otherwise
  */
 public static boolean anyStepRecursively(final Predicate predicate, 
final Traversal.Admin traversal) {
@@ -425,18 +425,19 @@ public final class TraversalHelper {
 if (predicate.test(step)) {
 return true;
 }
-if (step instanceof TraversalParent) {
-for (final Traversal.Admin localChild : 
((TraversalParent) step).getLocalChildren()) {
-if (anyStepRecursively(predicate, localChild)) return true;
-}
-for (final Traversal.Admin globalChild : 
((TraversalParent) step).getGlobalChildren()) {
-if (anyStepRecursively(predicate, globalChild)) return 
true;
-}
-}
+
+if (step instanceof TraversalParent) anyStepRecursively(predicate, 
((TraversalParent) step));
 }
 return false;
 }
 
+/**
+ * Determine if any child step of a {@link TraversalParent} match the step 
given the provided {@link Predicate}.
+ *
+ * @param predicate the match function
+ * @param step the step to perform the action on
+ * @return {@code true} if there is a match and {@code false} otherwise
+ */
 public static boolean anyStepRecursively(final Predicate predicate, 
final TraversalParent step) {
 for (final Traversal.Admin localChild : step.getLocalChildren()) 
{
 if (anyStepRecursively(predicate, localChild)) return true;



tinkerpop git commit: TINKERPOP-1642 Removed some extra iteration in Parameters.getTraversals()

2017-03-10 Thread spmallette
Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1642 d13210f53 -> 103d7f9df


TINKERPOP-1642 Removed some extra iteration in Parameters.getTraversals()


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

Branch: refs/heads/TINKERPOP-1642
Commit: 103d7f9df47e55c1a6d3e9d347ffdefc704fde39
Parents: d13210f
Author: Stephen Mallette 
Authored: Fri Mar 10 12:31:38 2017 -0500
Committer: Stephen Mallette 
Committed: Fri Mar 10 12:31:38 2017 -0500

--
 .../gremlin/process/traversal/step/util/Parameters.java  | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/103d7f9d/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
--
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
index 6640e87..93cf1f8 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
@@ -54,7 +54,7 @@ public final class Parameters implements Cloneable, 
Serializable {
  * {@link #set(Object...)} because when the parameter map is large the 
cost of iterating it repeatedly on the
  * high number of calls to {@link #getTraversals()} and {@link 
#integrateTraversals(TraversalParent)} is great.
  */
-private List traversals = new ArrayList<>();
+private List traversals = new ArrayList<>();
 
 /**
  * Checks for existence of key in parameter set.
@@ -203,11 +203,7 @@ public final class Parameters implements Cloneable, 
Serializable {
  */
 public  List> getTraversals() {
 // stupid generics - just need to return "traversals"
-final List> result = new ArrayList<>();
-for (Traversal.Admin t : traversals) {
-result.add(t);
-}
-return result;
+return (List>) (Object) traversals;
 }
 
 public Parameters clone() {



[10/17] tinkerpop git commit: TINKERPOP-1644 Updated changelog

2017-03-10 Thread spmallette
TINKERPOP-1644 Updated changelog


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

Branch: refs/heads/TINKERPOP-1644
Commit: b29ba12109e7e88bc3465d08f6177e5ded17ca59
Parents: 4bdeac4
Author: Stephen Mallette 
Authored: Wed Mar 8 16:15:27 2017 -0500
Committer: Stephen Mallette 
Committed: Fri Mar 10 11:12:36 2017 -0500

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


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b29ba121/CHANGELOG.asciidoc
--
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 24e5e9c..9c3313e 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ 
image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.2.5 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~
 
+* Moved the `caffeine` dependency down to `gremlin-groovy` and out of 
`gremlin-server`.
 * Script compilation is synchronised.
 * Script compilation times are placed in to logs.
 * Failed scripts will not be recompiled.



[06/17] tinkerpop git commit: TINKERPOP-1644 Use Caffeine cache

2017-03-10 Thread spmallette
TINKERPOP-1644
Use Caffeine cache


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

Branch: refs/heads/TINKERPOP-1644
Commit: 18778e405981523355319fa56bd04fd6cc07b845
Parents: deb6828
Author: BrynCooke 
Authored: Wed Mar 8 12:24:46 2017 +
Committer: Stephen Mallette 
Committed: Fri Mar 10 11:12:36 2017 -0500

--
 gremlin-groovy/pom.xml  |  5 ++
 .../jsr223/GremlinGroovyScriptEngine.java   | 75 +++-
 2 files changed, 48 insertions(+), 32 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/18778e40/gremlin-groovy/pom.xml
--
diff --git a/gremlin-groovy/pom.xml b/gremlin-groovy/pom.xml
index 511952a..474b458 100644
--- a/gremlin-groovy/pom.xml
+++ b/gremlin-groovy/pom.xml
@@ -70,6 +70,11 @@ limitations under the License.
 jbcrypt
 0.4
 
+
+com.github.ben-manes.caffeine
+caffeine
+2.3.1
+
 
 
 org.slf4j

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/18778e40/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
--
diff --git 
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
 
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
index 67275f8..51850ad 100644
--- 
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
+++ 
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
@@ -18,6 +18,9 @@
  */
 package org.apache.tinkerpop.gremlin.groovy.jsr223;
 
+import com.github.benmanes.caffeine.cache.CacheLoader;
+import com.github.benmanes.caffeine.cache.Caffeine;
+import com.github.benmanes.caffeine.cache.LoadingCache;
 import groovy.grape.Grape;
 import groovy.lang.Binding;
 import groovy.lang.Closure;
@@ -80,6 +83,8 @@ import java.util.Map;
 import java.util.ServiceLoader;
 import java.util.Set;
 import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executor;
 import java.util.concurrent.Future;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.regex.Pattern;
@@ -154,17 +159,44 @@ public class GremlinGroovyScriptEngine extends 
GroovyScriptEngineImpl
 }
 };
 
+private GremlinGroovyClassLoader loader;
+
 /**
  * Script to generated Class map.
  */
-private ManagedConcurrentValueMap classMap = new 
ManagedConcurrentValueMap<>(ReferenceBundle.getSoftBundle());
+private LoadingCache classMap = 
Caffeine.newBuilder().softValues().build(new CacheLoader() {
+@Override
+public Future load(String script) throws Exception {
+long start = System.currentTimeMillis();
+try {
+return CompletableFuture.supplyAsync(() -> 
loader.parseClass(script, generateScriptName()), command -> command.run());
+} catch (Exception e) {
+if (e.getCause() instanceof CompilationFailedException) {
+long finish = System.currentTimeMillis();
+log.error("Script compilation FAILED {} took {}ms {}", 
script, finish - start, e.getCause());
+throw (CompilationFailedException) e.getCause();
+} else {
+throw new AssertionError("Unexpected exception when 
compiling script", e);
+}
+} finally {
+long time = System.currentTimeMillis() - start;
+if (time > 5000) {
+//We warn if a script took longer than a few seconds. 
Repeatedly seeing these warnings is a sign that something is wrong.
+//Scripts with a large numbers of parameters often trigger 
this and should be avoided.
+log.warn("Script compilation {} took {}ms", script, time);
+} else {
+log.debug("Script compilation {} took {}ms", script, time);
+}
+}
+}
+
+});
 
 /**
  * Global closures map - this is used to simulate a single global 
functions namespace
  */
 private ManagedConcurrentValueMap globalClosures = new 

[17/17] tinkerpop git commit: TINKERPOP-1644 Exposed GremlinScriptEngine metrics in Gremlin Server

2017-03-10 Thread spmallette
TINKERPOP-1644 Exposed GremlinScriptEngine metrics in Gremlin Server


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

Branch: refs/heads/TINKERPOP-1644
Commit: b689deb1dd1a0c745966a1ed5f8e7e3b2d543af2
Parents: 8ffa5af
Author: Stephen Mallette 
Authored: Thu Mar 9 12:25:35 2017 -0500
Committer: Stephen Mallette 
Committed: Fri Mar 10 11:13:03 2017 -0500

--
 CHANGELOG.asciidoc  |  2 +-
 .../gremlin/groovy/engine/ScriptEngines.java|  7 ++
 .../gremlin/server/op/session/Session.java  | 27 +++
 .../gremlin/server/util/MetricManager.java  | 79 +---
 .../server/util/ServerGremlinExecutor.java  | 15 
 5 files changed, 118 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b689deb1/CHANGELOG.asciidoc
--
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 3729271..a306dea 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,7 +26,7 @@ 
image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.2.5 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~
 
-* Added various metrics to the `GremlinGroovyScriptEngine` around script 
compilation.
+* Added various metrics to the `GremlinGroovyScriptEngine` around script 
compilation and exposed them in Gremlin Server.
 * Moved the `caffeine` dependency down to `gremlin-groovy` and out of 
`gremlin-server`.
 * Improved script compilation in `GremlinGroovyScriptEngine to use better 
caching, log long compile times and prevent failed compilations from 
recompiling on future requests.
 * Script compilation is synchronised.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b689deb1/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/ScriptEngines.java
--
diff --git 
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/ScriptEngines.java
 
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/ScriptEngines.java
index 7dcfc5c..6dfd87a 100644
--- 
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/ScriptEngines.java
+++ 
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/ScriptEngines.java
@@ -311,6 +311,13 @@ public class ScriptEngines implements AutoCloseable {
 }
 
 /**
+ * Gets an {@link GremlinScriptEngine} by its name.
+ */
+public GremlinScriptEngine getEngineByName(final String engineName) {
+return scriptEngines.get(engineName);
+}
+
+/**
  * Get the set of {@code ScriptEngine} that implement {@link 
DependencyManager} interface.
  */
 private Set getDependencyManagers() {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b689deb1/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/session/Session.java
--
diff --git 
a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/session/Session.java
 
b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/session/Session.java
index 9b16a3b..b8cb28c 100644
--- 
a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/session/Session.java
+++ 
b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/session/Session.java
@@ -18,11 +18,16 @@
  */
 package org.apache.tinkerpop.gremlin.server.op.session;
 
+import com.codahale.metrics.Metric;
+import com.codahale.metrics.MetricFilter;
 import org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor;
+import org.apache.tinkerpop.gremlin.groovy.engine.ScriptEngines;
+import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngine;
 import org.apache.tinkerpop.gremlin.server.Context;
 import org.apache.tinkerpop.gremlin.server.GraphManager;
 import org.apache.tinkerpop.gremlin.server.Settings;
 import org.apache.tinkerpop.gremlin.server.util.LifeCycleHook;
+import org.apache.tinkerpop.gremlin.server.util.MetricManager;
 import org.apache.tinkerpop.gremlin.server.util.ThreadFactoryUtil;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.slf4j.Logger;
@@ -30,6 +35,7 @@ import org.slf4j.LoggerFactory;
 
 import javax.script.Bindings;
 import javax.script.SimpleBindings;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ExecutorService;
@@ -92,6 +98,15 @@ 

[04/17] tinkerpop git commit: TINKERPOP-1644 Use future instead of maintaining a separate map of failures.

2017-03-10 Thread spmallette
TINKERPOP-1644
Use future instead of maintaining a separate map of failures.


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

Branch: refs/heads/TINKERPOP-1644
Commit: deb68280d986b086120d56a73659b1869c07a475
Parents: 13c93ca
Author: BrynCooke 
Authored: Tue Mar 7 16:54:58 2017 +
Committer: Stephen Mallette 
Committed: Fri Mar 10 11:12:36 2017 -0500

--
 .../jsr223/GremlinGroovyScriptEngine.java   | 69 
 1 file changed, 26 insertions(+), 43 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/deb68280/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
--
diff --git 
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
 
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
index a8365a2..67275f8 100644
--- 
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
+++ 
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
@@ -79,6 +79,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.ServiceLoader;
 import java.util.Set;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.Future;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
@@ -155,8 +157,7 @@ public class GremlinGroovyScriptEngine extends 
GroovyScriptEngineImpl
 /**
  * Script to generated Class map.
  */
-private ManagedConcurrentValueMap classMap = new 
ManagedConcurrentValueMap<>(ReferenceBundle.getSoftBundle());
-private ManagedConcurrentValueMap 
failedClassMap = new 
ManagedConcurrentValueMap<>(ReferenceBundle.getSoftBundle());
+private ManagedConcurrentValueMap classMap = new 
ManagedConcurrentValueMap<>(ReferenceBundle.getSoftBundle());
 
 /**
  * Global closures map - this is used to simulate a single global 
functions namespace
@@ -533,56 +534,38 @@ public class GremlinGroovyScriptEngine extends 
GroovyScriptEngineImpl
 return makeInterface(thiz, clazz);
 }
 
-private Class getScriptClassFromMap(String script) throws 
CompilationFailedException {
-CompilationFailedException exception = failedClassMap.get(script);
-if(exception != null) {
-throw exception;
-}
-return classMap.get(script);
-
-}
-
 Class getScriptClass(final String script) throws 
CompilationFailedException {
-Class clazz = getScriptClassFromMap(script);
-if (clazz != null) {
-return clazz;
-}
-synchronized (this) {
-clazz = getScriptClassFromMap(script);
+Future clazz = classMap.get(script);
+
+long start = System.currentTimeMillis();
+try {
 if (clazz != null) {
-return clazz;
+return clazz.get();
 }
 
-long start = System.currentTimeMillis();
-try {
-clazz = loader.parseClass(script, generateScriptName());
-long time = System.currentTimeMillis() - start;
-if(time > 5000) {
-//We warn if a script took longer than a few seconds. 
Repeatedly seeing these warnings is a sign that something is wrong.
-//Scripts with a large numbers of parameters often trigger 
this and should be avoided.
-log.warn("Script compilation {} took {}ms", script, time);
-}
-else {
-log.debug("Script compilation {} took {}ms", script, time);
-}
-
+clazz = CompletableFuture.supplyAsync(() -> 
loader.parseClass(script, generateScriptName()));
+classMap.put(script, clazz);
+return clazz.get();
 
-}
-catch(CompilationFailedException t) {
+} catch (Exception e) {
+if (e.getCause() instanceof CompilationFailedException) {
 long finish = System.currentTimeMillis();
-log.error("Script compilation FAILED {} took {}ms {}", script, 
finish - start, t);
-failedClassMap.put(script, t);
-throw t;
+log.error("Script compilation FAILED {} took {}ms {}", script, 
finish - start, e.getCause());
+  

[11/17] tinkerpop git commit: TINKERPOP-1644 Provided configuration options for GremlinGroovyScriptEngine

2017-03-10 Thread spmallette
TINKERPOP-1644 Provided configuration options for GremlinGroovyScriptEngine

Introduced new customizers to pass in configuration options to the 
GremlinGroovyScriptEngine.


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

Branch: refs/heads/TINKERPOP-1644
Commit: 4bdeac4b796b38fb14d1be763e03cc837b57d3d7
Parents: de1d58a
Author: Stephen Mallette 
Authored: Wed Mar 8 16:13:06 2017 -0500
Committer: Stephen Mallette 
Committed: Fri Mar 10 11:12:36 2017 -0500

--
 .../jsr223/CompilationOptionsCustomizer.java| 39 ++
 .../jsr223/GremlinGroovyScriptEngine.java   | 36 +++--
 .../jsr223/GroovyCompilerGremlinPlugin.java | 13 
 .../CompilationOptionsCustomizerProvider.java   | 48 
 ...roovyScriptEngineCompilationOptionsTest.java | 80 
 .../jsr223/GroovyCompilerGremlinPluginTest.java | 24 --
 6 files changed, 225 insertions(+), 15 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4bdeac4b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/CompilationOptionsCustomizer.java
--
diff --git 
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/CompilationOptionsCustomizer.java
 
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/CompilationOptionsCustomizer.java
new file mode 100644
index 000..2a22eb3
--- /dev/null
+++ 
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/CompilationOptionsCustomizer.java
@@ -0,0 +1,39 @@
+/*
+ * 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.groovy.jsr223;
+
+import org.apache.tinkerpop.gremlin.jsr223.Customizer;
+
+/**
+ * Provides some custom compilation options to the {@link 
GremlinGroovyScriptEngine}.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+class CompilationOptionsCustomizer implements Customizer {
+
+private final int expectedCompilationTime;
+
+public CompilationOptionsCustomizer(final int expectedCompilationTime) {
+this.expectedCompilationTime = expectedCompilationTime;
+}
+
+public int getExpectedCompilationTime() {
+return expectedCompilationTime;
+}
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4bdeac4b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
--
diff --git 
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
 
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
index 42d954a..5168130 100644
--- 
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
+++ 
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
@@ -35,6 +35,7 @@ import 
org.apache.tinkerpop.gremlin.groovy.DefaultImportCustomizerProvider;
 import org.apache.tinkerpop.gremlin.groovy.EmptyImportCustomizerProvider;
 import org.apache.tinkerpop.gremlin.groovy.ImportCustomizerProvider;
 import org.apache.tinkerpop.gremlin.groovy.NoImportCustomizerProvider;
+import 
org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.CompilationOptionsCustomizerProvider;
 import 
org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.ConfigurationCustomizerProvider;
 import 
org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.InterpreterModeCustomizerProvider;
 import org.apache.tinkerpop.gremlin.groovy.loaders.GremlinLoader;
@@ -80,11 +81,11 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 import 

[01/17] tinkerpop git commit: Fixed an NPE in GraphMLReader where if the doesn't have an ID field and the base graph supports ids, then an NPE happens. Added a test case to verifiy working beha

2017-03-10 Thread spmallette
Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1644 45822ede9 -> 33db1a389 (forced update)


Fixed an NPE in GraphMLReader where if the  doesn't have an ID field and 
the base graph supports ids, then an NPE happens. Added a test case to verifiy 
working behavior. Super simple fix. CTR.


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

Branch: refs/heads/TINKERPOP-1644
Commit: 61a3d125c48869c8e5fdaf195abbb46fbaaf0c30
Parents: 9ea319d
Author: Marko A. Rodriguez 
Authored: Thu Mar 9 14:49:36 2017 -0700
Committer: Marko A. Rodriguez 
Committed: Thu Mar 9 14:49:36 2017 -0700

--
 .../structure/io/graphml/GraphMLReader.java | 19 +++--
 .../tinkerpop/gremlin/structure/io/IoTest.java  | 25 ++--
 .../structure/io/graphml/graph-no-edge-ids.xml  | 30 
 3 files changed, 62 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/61a3d125/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLReader.java
--
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLReader.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLReader.java
index e161ba7..3289166 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLReader.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLReader.java
@@ -19,10 +19,10 @@
 package org.apache.tinkerpop.gremlin.structure.io.graphml;
 
 import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.apache.tinkerpop.gremlin.structure.Property;
-import org.apache.tinkerpop.gremlin.structure.T;
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Property;
+import org.apache.tinkerpop.gremlin.structure.T;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.apache.tinkerpop.gremlin.structure.io.GraphReader;
@@ -72,7 +72,7 @@ public final class GraphMLReader implements GraphReader {
 
 @Override
 public void readGraph(final InputStream graphInputStream, final Graph 
graphToWriteTo) throws IOException {
-final Map cache = new HashMap<>();
+final Map cache = new HashMap<>();
 final AtomicLong counter = new AtomicLong(0);
 final boolean supportsTx = 
graphToWriteTo.features().graph().supportsTransactions();
 final Graph.Features.EdgeFeatures edgeFeatures = 
graphToWriteTo.features().edge();
@@ -186,9 +186,9 @@ public final class GraphMLReader implements GraphReader {
 isInVertex = false;
 } else if (elementName.equals(GraphMLTokens.EDGE)) {
 final Object[] propsAsArray = 
edgeProps.entrySet().stream().flatMap(e -> Stream.of(e.getKey(), 
e.getValue())).toArray();
-final Object[] propsReady = 
edgeFeatures.willAllowId(edgeId) ? ElementHelper.upsert(propsAsArray, T.id, 
edgeId) : propsAsArray;
-
-   edgeOutVertex.addEdge(null == edgeLabel ? 
Edge.DEFAULT_LABEL : edgeLabel, edgeInVertex, propsReady);
+final Object[] propsReady = null != edgeId && 
edgeFeatures.willAllowId(edgeId) ? ElementHelper.upsert(propsAsArray, T.id, 
edgeId) : propsAsArray;
+
+edgeOutVertex.addEdge(null == edgeLabel ? 
Edge.DEFAULT_LABEL : edgeLabel, edgeInVertex, propsReady);
 
 if (supportsTx && counter.incrementAndGet() % 
batchSize == 0)
 graphToWriteTo.tx().commit();
@@ -292,7 +292,7 @@ public final class GraphMLReader implements GraphReader {
 
 private static Vertex findOrCreate(final Object id, final Graph 
graphToWriteTo,
final Graph.Features.VertexFeatures 
features,
-   final Map cache, final 
boolean asVertex, final Object... args) {
+   final Map cache, final 
boolean asVertex, final Object... args) {
 if (cache.containsKey(id)) {
 // if the request to findOrCreate come from a vertex then AND the 
vertex was already created, that means
 // that the vertex was created by an edge that arrived first in 

[09/17] tinkerpop git commit: TINKERPOP-1644 Minor code format updates

2017-03-10 Thread spmallette
TINKERPOP-1644 Minor code format updates


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

Branch: refs/heads/TINKERPOP-1644
Commit: de1d58ab33c3121e9bafb5e4908f3e0d76c8e26e
Parents: 608f024
Author: Stephen Mallette 
Authored: Wed Mar 8 13:37:42 2017 -0500
Committer: Stephen Mallette 
Committed: Fri Mar 10 11:12:36 2017 -0500

--
 .../groovy/jsr223/GremlinGroovyScriptEngine.java| 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/de1d58ab/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
--
diff --git 
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
 
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
index cadc3b0..42d954a 100644
--- 
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
+++ 
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
@@ -164,20 +164,20 @@ public class GremlinGroovyScriptEngine extends 
GroovyScriptEngineImpl
 /**
  * Script to generated Class map.
  */
-private LoadingCache classMap = 
Caffeine.newBuilder().softValues().build(new CacheLoader() {
+private final LoadingCache classMap = 
Caffeine.newBuilder().softValues().build(new CacheLoader() {
 @Override
-public Future load(String script) throws Exception {
-long start = System.currentTimeMillis();
+public Future load(final String script) throws Exception {
+final long start = System.currentTimeMillis();
 
 return CompletableFuture.supplyAsync(() -> {
 try {
 return loader.parseClass(script, generateScriptName());
 } catch (CompilationFailedException e) {
-long finish = System.currentTimeMillis();
+final long finish = System.currentTimeMillis();
 log.error("Script compilation FAILED {} took {}ms {}", 
script, finish - start, e);
 throw e;
 } finally {
-long time = System.currentTimeMillis() - start;
+final long time = System.currentTimeMillis() - start;
 if (time > 5000) {
 //We warn if a script took longer than a few seconds. 
Repeatedly seeing these warnings is a sign that something is wrong.
 //Scripts with a large numbers of parameters often 
trigger this and should be avoided.
@@ -186,7 +186,7 @@ public class GremlinGroovyScriptEngine extends 
GroovyScriptEngineImpl
 log.debug("Script compilation {} took {}ms", script, 
time);
 }
 }
-}, command -> command.run());
+}, Runnable::run);
 }
 
 });



[05/17] tinkerpop git commit: TINKERPOP-1644 Improve script compilation syncronisation Script compilation is synchronised. Script compilation times are placed in to logs. Failed scripts will not be re

2017-03-10 Thread spmallette
TINKERPOP-1644 Improve script compilation syncronisation
Script compilation is synchronised.
Script compilation times are placed in to logs.
Failed scripts will not be recompiled.
Scripts that take over 5 seconds to compile are logged as a warning.


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

Branch: refs/heads/TINKERPOP-1644
Commit: 13c93cabac51112a73f592e0fba12e515f643522
Parents: 60a3fb3
Author: BrynCooke 
Authored: Thu Mar 2 19:07:28 2017 +
Committer: Stephen Mallette 
Committed: Fri Mar 10 11:12:36 2017 -0500

--
 CHANGELOG.asciidoc  |  4 ++
 .../jsr223/GremlinGroovyScriptEngine.java   | 57 ++--
 2 files changed, 56 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/13c93cab/CHANGELOG.asciidoc
--
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 6861d57..24e5e9c 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,10 @@ 
image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.2.5 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~
 
+* Script compilation is synchronised.
+* Script compilation times are placed in to logs.
+* Failed scripts will not be recompiled.
+* Scripts that take over 5 seconds to compile are logged as a warning.
 * Fixed an `NullPointerException` in `GraphMLReader` that occurred when an 
`` didn't have an ID field and the base graph supported ID assignment.
 * Split `ComputerVerificationStrategy` into two strategies: 
`ComputerVerificationStrategy` and `ComputerFinalizationStrategy`.
 * Removed `HasTest.g_V_hasId_compilationEquality` from process test suite as 
it makes too many assumptions about provider compilation.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/13c93cab/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
--
diff --git 
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
 
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
index 1fb2efc..a8365a2 100644
--- 
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
+++ 
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
@@ -56,6 +56,8 @@ import org.codehaus.groovy.runtime.InvokerHelper;
 import org.codehaus.groovy.runtime.MetaClassHelper;
 import org.codehaus.groovy.runtime.MethodClosure;
 import org.codehaus.groovy.util.ReferenceBundle;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.script.Bindings;
 import javax.script.CompiledScript;
@@ -93,6 +95,7 @@ import java.util.stream.Collectors;
 public class GremlinGroovyScriptEngine extends GroovyScriptEngineImpl
 implements DependencyManager, AutoCloseable, GremlinScriptEngine {
 
+private static final Logger log = 
LoggerFactory.getLogger(GremlinGroovyScriptEngine.class);
 /**
  * An "internal" key for sandboxing the script engine - technically not 
for public use.
  */
@@ -153,6 +156,7 @@ public class GremlinGroovyScriptEngine extends 
GroovyScriptEngineImpl
  * Script to generated Class map.
  */
 private ManagedConcurrentValueMap classMap = new 
ManagedConcurrentValueMap<>(ReferenceBundle.getSoftBundle());
+private ManagedConcurrentValueMap 
failedClassMap = new 
ManagedConcurrentValueMap<>(ReferenceBundle.getSoftBundle());
 
 /**
  * Global closures map - this is used to simulate a single global 
functions namespace
@@ -529,13 +533,56 @@ public class GremlinGroovyScriptEngine extends 
GroovyScriptEngineImpl
 return makeInterface(thiz, clazz);
 }
 
+private Class getScriptClassFromMap(String script) throws 
CompilationFailedException {
+CompilationFailedException exception = failedClassMap.get(script);
+if(exception != null) {
+throw exception;
+}
+return classMap.get(script);
+
+}
+
 Class getScriptClass(final String script) throws 
CompilationFailedException {
-Class clazz = classMap.get(script);
-if (clazz != null) return clazz;
+Class clazz = getScriptClassFromMap(script);
+if (clazz != null) {
+return clazz;
+}
+  

[02/17] tinkerpop git commit: Updated changelog CTR

2017-03-10 Thread spmallette
Updated changelog CTR


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

Branch: refs/heads/TINKERPOP-1644
Commit: 60a3fb33e33245f2ad9f3b1494d349c7ccf482b5
Parents: 61a3d12
Author: Stephen Mallette 
Authored: Fri Mar 10 06:30:27 2017 -0500
Committer: Stephen Mallette 
Committed: Fri Mar 10 06:30:27 2017 -0500

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


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/60a3fb33/CHANGELOG.asciidoc
--
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 04541d6..6861d57 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ 
image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.2.5 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~
 
+* Fixed an `NullPointerException` in `GraphMLReader` that occurred when an 
`` didn't have an ID field and the base graph supported ID assignment.
 * Split `ComputerVerificationStrategy` into two strategies: 
`ComputerVerificationStrategy` and `ComputerFinalizationStrategy`.
 * Removed `HasTest.g_V_hasId_compilationEquality` from process test suite as 
it makes too many assumptions about provider compilation.
 * Deprecated `CustomizerProvider` infrastructure.



[07/17] tinkerpop git commit: TINKERPOP-1644 Remove gremlin-server caffeine dependency

2017-03-10 Thread spmallette
TINKERPOP-1644 Remove gremlin-server caffeine dependency

Caffeine is now down in gremlin-groovy.


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

Branch: refs/heads/TINKERPOP-1644
Commit: 608f024f7bb83eb168a6aa637d46ee0650674903
Parents: 1df71c8
Author: Stephen Mallette 
Authored: Wed Mar 8 13:31:52 2017 -0500
Committer: Stephen Mallette 
Committed: Fri Mar 10 11:12:36 2017 -0500

--
 gremlin-server/pom.xml | 5 -
 1 file changed, 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/608f024f/gremlin-server/pom.xml
--
diff --git a/gremlin-server/pom.xml b/gremlin-server/pom.xml
index adb41fd..7a4cad9 100644
--- a/gremlin-server/pom.xml
+++ b/gremlin-server/pom.xml
@@ -55,11 +55,6 @@ limitations under the License.
 log4j
 true
 
-
-com.github.ben-manes.caffeine
-caffeine
-2.3.1
-
 
 
 com.codahale.metrics



[16/17] tinkerpop git commit: TINKERPOP-1644 Added metrics to GremlinGroovyScriptEngine

2017-03-10 Thread spmallette
TINKERPOP-1644 Added metrics to GremlinGroovyScriptEngine


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

Branch: refs/heads/TINKERPOP-1644
Commit: 8ffa5af6ff56933c1955e88e8aa42c06cb69162b
Parents: a06072b
Author: Stephen Mallette 
Authored: Thu Mar 9 10:30:17 2017 -0500
Committer: Stephen Mallette 
Committed: Fri Mar 10 11:13:03 2017 -0500

--
 CHANGELOG.asciidoc  |   2 +
 .../jsr223/GremlinGroovyScriptEngine.java   | 122 ++-
 ...roovyScriptEngineCompilationOptionsTest.java |   8 +-
 .../jsr223/GremlinGroovyScriptEngineTest.java   |  70 ++-
 4 files changed, 193 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8ffa5af6/CHANGELOG.asciidoc
--
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 9c3313e..3729271 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,7 +26,9 @@ 
image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.2.5 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~
 
+* Added various metrics to the `GremlinGroovyScriptEngine` around script 
compilation.
 * Moved the `caffeine` dependency down to `gremlin-groovy` and out of 
`gremlin-server`.
+* Improved script compilation in `GremlinGroovyScriptEngine to use better 
caching, log long compile times and prevent failed compilations from 
recompiling on future requests.
 * Script compilation is synchronised.
 * Script compilation times are placed in to logs.
 * Failed scripts will not be recompiled.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8ffa5af6/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
--
diff --git 
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
 
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
index 3bcb06c..0ed8d84 100644
--- 
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
+++ 
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
@@ -164,7 +164,10 @@ public class GremlinGroovyScriptEngine extends 
GroovyScriptEngineImpl
 /**
  * Script to generated Class map.
  */
-private final LoadingCache classMap = 
Caffeine.newBuilder().softValues().build(new CacheLoader() {
+private final LoadingCache classMap = 
Caffeine.newBuilder().
+softValues().
+recordStats().
+build(new CacheLoader() {
 @Override
 public Future load(final String script) throws Exception {
 final long start = System.currentTimeMillis();
@@ -175,6 +178,7 @@ public class GremlinGroovyScriptEngine extends 
GroovyScriptEngineImpl
 } catch (CompilationFailedException e) {
 final long finish = System.currentTimeMillis();
 log.error("Script compilation FAILED {} took {}ms {}", 
script, finish - start, e);
+failedCompilationCount.incrementAndGet();
 throw e;
 } finally {
 final long time = System.currentTimeMillis() - start;
@@ -208,6 +212,13 @@ public class GremlinGroovyScriptEngine extends 
GroovyScriptEngineImpl
 private final AtomicLong longRunCompilationCount = new AtomicLong(0L);
 
 /**
+ * A counter for the instance that tracks the number of failed 
compilations. Note that the failures need to be
+ * tracked outside of cache failure load stats because the loading 
mechanism will always successfully return
+ * a future and won't trigger a failure.
+ */
+private final AtomicLong failedCompilationCount = new AtomicLong(0L);
+
+/**
  * The list of loaded plugins for the console.
  */
 private final Set loadedPlugins = new HashSet<>();
@@ -589,10 +600,117 @@ public class GremlinGroovyScriptEngine extends 
GroovyScriptEngineImpl
 /**
  * Gets the number of compilations that extended beyond the {@link 
#expectedCompilationTime}.
  */
-public long getLongRunCompilationCount() {
+public long getClassCacheLongRunCompilationCount() {
 return longRunCompilationCount.longValue();
 }
 
+/**
+ * Gets 

[12/17] tinkerpop git commit: TINKERPOP-1644 Made the "counter" in GremlinGroovyScriptEngine static

2017-03-10 Thread spmallette
TINKERPOP-1644 Made the "counter" in GremlinGroovyScriptEngine static

It seems that this field should be static and shared across all instances as 
the script name seems to share space with other GroovyClassLoaders. Not sure 
what would happen in the case of collision, but there doesn't seem to be much 
harm in ensuring better uniqueness. This counter wasn't used for tracking the 
number of scripts actually processed or anything so it should be ok to make 
this change without fear of breaking anything.


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

Branch: refs/heads/TINKERPOP-1644
Commit: a06072b0502f9b42fee4c68dba554b4991406c36
Parents: b29ba12
Author: Stephen Mallette 
Authored: Wed Mar 8 16:17:40 2017 -0500
Committer: Stephen Mallette 
Committed: Fri Mar 10 11:12:37 2017 -0500

--
 .../groovy/jsr223/GremlinGroovyScriptEngine.java| 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a06072b0/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
--
diff --git 
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
 
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
index 5168130..3bcb06c 100644
--- 
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
+++ 
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
@@ -196,7 +196,15 @@ public class GremlinGroovyScriptEngine extends 
GroovyScriptEngineImpl
  */
 private final ManagedConcurrentValueMap globalClosures = 
new ManagedConcurrentValueMap<>(ReferenceBundle.getHardBundle());
 
-private final AtomicLong counter = new AtomicLong(0L);
+/**
+ * Ensures unique script names across all instances.
+ */
+private final static AtomicLong scriptNameCounter = new AtomicLong(0L);
+
+/**
+ * A counter for the instance that tracks the number of warnings issued 
during script compilations that exceeded
+ * the {@link #expectedCompilationTime}.
+ */
 private final AtomicLong longRunCompilationCount = new AtomicLong(0L);
 
 /**
@@ -799,7 +807,7 @@ public class GremlinGroovyScriptEngine extends 
GroovyScriptEngineImpl
 }
 
 private synchronized String generateScriptName() {
-return SCRIPT + counter.incrementAndGet() + DOT_GROOVY;
+return SCRIPT + scriptNameCounter.incrementAndGet() + DOT_GROOVY;
 }
 
 @SuppressWarnings("unchecked")



[14/17] tinkerpop git commit: TINKERPOP-1644 Cleaned up a bad import

2017-03-10 Thread spmallette
TINKERPOP-1644 Cleaned up a bad import


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

Branch: refs/heads/TINKERPOP-1644
Commit: 33db1a3893c91a2dde100c8a0289312d4550503c
Parents: 3797652
Author: Stephen Mallette 
Authored: Thu Mar 9 14:51:36 2017 -0500
Committer: Stephen Mallette 
Committed: Fri Mar 10 11:13:03 2017 -0500

--
 .../groovy/jsr223/GroovyCompilerGremlinPluginTest.java| 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/33db1a38/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCompilerGremlinPluginTest.java
--
diff --git 
a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCompilerGremlinPluginTest.java
 
b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCompilerGremlinPluginTest.java
index bacfc90..d8cf571 100644
--- 
a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCompilerGremlinPluginTest.java
+++ 
b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCompilerGremlinPluginTest.java
@@ -26,7 +26,6 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Optional;
 
-import static 
org.apache.tinkerpop.gremlin.groovy.jsr223.GroovyCompilerGremlinPlugin.*;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.core.Is.is;
 import static org.hamcrest.core.IsInstanceOf.instanceOf;
@@ -40,7 +39,7 @@ public class GroovyCompilerGremlinPluginTest {
 @Test
 public void shouldConfigureForGroovyOnly() {
 final GroovyCompilerGremlinPlugin plugin = 
GroovyCompilerGremlinPlugin.build().
-compilation(Compilation.COMPILE_STATIC).create();
+
compilation(GroovyCompilerGremlinPlugin.Compilation.COMPILE_STATIC).create();
 final Optional customizers = 
plugin.getCustomizers("gremlin-not-real");
 assertThat(customizers.isPresent(), is(false));
 }
@@ -49,7 +48,7 @@ public class GroovyCompilerGremlinPluginTest {
 public void shouldConfigureWithCompileStatic() {
 final GroovyCompilerGremlinPlugin plugin = 
GroovyCompilerGremlinPlugin.build().
 expectedCompilationTime(0).
-compilation(Compilation.COMPILE_STATIC).create();
+
compilation(GroovyCompilerGremlinPlugin.Compilation.COMPILE_STATIC).create();
 final Optional customizers = 
plugin.getCustomizers("gremlin-groovy");
 assertThat(customizers.isPresent(), is(true));
 assertEquals(1, customizers.get().length);
@@ -60,7 +59,7 @@ public class GroovyCompilerGremlinPluginTest {
 public void shouldConfigureWithTypeChecked() {
 final GroovyCompilerGremlinPlugin plugin = 
GroovyCompilerGremlinPlugin.build().
 expectedCompilationTime(0).
-compilation(Compilation.TYPE_CHECKED).create();
+
compilation(GroovyCompilerGremlinPlugin.Compilation.TYPE_CHECKED).create();
 final Optional customizers = 
plugin.getCustomizers("gremlin-groovy");
 assertThat(customizers.isPresent(), is(true));
 assertEquals(1, customizers.get().length);



[03/17] tinkerpop git commit: TINKERPOP-1644 Fix exception handling.

2017-03-10 Thread spmallette
TINKERPOP-1644
Fix exception handling.


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

Branch: refs/heads/TINKERPOP-1644
Commit: 17a72e0e1db6fe52d3a0821ef2bfae1eb39be856
Parents: 18778e4
Author: BrynCooke 
Authored: Wed Mar 8 13:23:30 2017 +
Committer: Stephen Mallette 
Committed: Fri Mar 10 11:12:36 2017 -0500

--
 .../jsr223/GremlinGroovyScriptEngine.java   | 33 ++--
 1 file changed, 16 insertions(+), 17 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/17a72e0e/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
--
diff --git 
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
 
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
index 51850ad..2151a82 100644
--- 
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
+++ 
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
@@ -168,26 +168,25 @@ public class GremlinGroovyScriptEngine extends 
GroovyScriptEngineImpl
 @Override
 public Future load(String script) throws Exception {
 long start = System.currentTimeMillis();
-try {
-return CompletableFuture.supplyAsync(() -> 
loader.parseClass(script, generateScriptName()), command -> command.run());
-} catch (Exception e) {
-if (e.getCause() instanceof CompilationFailedException) {
+
+return CompletableFuture.supplyAsync(() -> {
+try {
+return loader.parseClass(script, generateScriptName());
+} catch (CompilationFailedException e) {
 long finish = System.currentTimeMillis();
 log.error("Script compilation FAILED {} took {}ms {}", 
script, finish - start, e.getCause());
-throw (CompilationFailedException) e.getCause();
-} else {
-throw new AssertionError("Unexpected exception when 
compiling script", e);
-}
-} finally {
-long time = System.currentTimeMillis() - start;
-if (time > 5000) {
-//We warn if a script took longer than a few seconds. 
Repeatedly seeing these warnings is a sign that something is wrong.
-//Scripts with a large numbers of parameters often trigger 
this and should be avoided.
-log.warn("Script compilation {} took {}ms", script, time);
-} else {
-log.debug("Script compilation {} took {}ms", script, time);
+throw e;
+} finally {
+long time = System.currentTimeMillis() - start;
+if (time > 5000) {
+//We warn if a script took longer than a few seconds. 
Repeatedly seeing these warnings is a sign that something is wrong.
+//Scripts with a large numbers of parameters often 
trigger this and should be avoided.
+log.warn("Script compilation {} took {}ms", script, 
time);
+} else {
+log.debug("Script compilation {} took {}ms", script, 
time);
+}
 }
-}
+}, command -> command.run());
 }
 
 });



[08/17] tinkerpop git commit: TINKERPOP-1644 Fix exception handling.

2017-03-10 Thread spmallette
TINKERPOP-1644
Fix exception handling.


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

Branch: refs/heads/TINKERPOP-1644
Commit: 1df71c81e032daa9c9db6f626d99c39b37d434ce
Parents: 17a72e0
Author: BrynCooke 
Authored: Wed Mar 8 13:26:31 2017 +
Committer: Stephen Mallette 
Committed: Fri Mar 10 11:12:36 2017 -0500

--
 .../tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1df71c81/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
--
diff --git 
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
 
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
index 2151a82..cadc3b0 100644
--- 
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
+++ 
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
@@ -174,7 +174,7 @@ public class GremlinGroovyScriptEngine extends 
GroovyScriptEngineImpl
 return loader.parseClass(script, generateScriptName());
 } catch (CompilationFailedException e) {
 long finish = System.currentTimeMillis();
-log.error("Script compilation FAILED {} took {}ms {}", 
script, finish - start, e.getCause());
+log.error("Script compilation FAILED {} took {}ms {}", 
script, finish - start, e);
 throw e;
 } finally {
 long time = System.currentTimeMillis() - start;



[1/4] tinkerpop git commit: Fixed an NPE in GraphMLReader where if the doesn't have an ID field and the base graph supports ids, then an NPE happens. Added a test case to verifiy working behavi

2017-03-10 Thread spmallette
Repository: tinkerpop
Updated Branches:
  refs/heads/master 1cd24031d -> b5bd36bf5


Fixed an NPE in GraphMLReader where if the  doesn't have an ID field and 
the base graph supports ids, then an NPE happens. Added a test case to verifiy 
working behavior. Super simple fix. CTR.


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

Branch: refs/heads/master
Commit: 61a3d125c48869c8e5fdaf195abbb46fbaaf0c30
Parents: 9ea319d
Author: Marko A. Rodriguez 
Authored: Thu Mar 9 14:49:36 2017 -0700
Committer: Marko A. Rodriguez 
Committed: Thu Mar 9 14:49:36 2017 -0700

--
 .../structure/io/graphml/GraphMLReader.java | 19 +++--
 .../tinkerpop/gremlin/structure/io/IoTest.java  | 25 ++--
 .../structure/io/graphml/graph-no-edge-ids.xml  | 30 
 3 files changed, 62 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/61a3d125/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLReader.java
--
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLReader.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLReader.java
index e161ba7..3289166 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLReader.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLReader.java
@@ -19,10 +19,10 @@
 package org.apache.tinkerpop.gremlin.structure.io.graphml;
 
 import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.apache.tinkerpop.gremlin.structure.Property;
-import org.apache.tinkerpop.gremlin.structure.T;
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Property;
+import org.apache.tinkerpop.gremlin.structure.T;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.apache.tinkerpop.gremlin.structure.io.GraphReader;
@@ -72,7 +72,7 @@ public final class GraphMLReader implements GraphReader {
 
 @Override
 public void readGraph(final InputStream graphInputStream, final Graph 
graphToWriteTo) throws IOException {
-final Map cache = new HashMap<>();
+final Map cache = new HashMap<>();
 final AtomicLong counter = new AtomicLong(0);
 final boolean supportsTx = 
graphToWriteTo.features().graph().supportsTransactions();
 final Graph.Features.EdgeFeatures edgeFeatures = 
graphToWriteTo.features().edge();
@@ -186,9 +186,9 @@ public final class GraphMLReader implements GraphReader {
 isInVertex = false;
 } else if (elementName.equals(GraphMLTokens.EDGE)) {
 final Object[] propsAsArray = 
edgeProps.entrySet().stream().flatMap(e -> Stream.of(e.getKey(), 
e.getValue())).toArray();
-final Object[] propsReady = 
edgeFeatures.willAllowId(edgeId) ? ElementHelper.upsert(propsAsArray, T.id, 
edgeId) : propsAsArray;
-
-   edgeOutVertex.addEdge(null == edgeLabel ? 
Edge.DEFAULT_LABEL : edgeLabel, edgeInVertex, propsReady);
+final Object[] propsReady = null != edgeId && 
edgeFeatures.willAllowId(edgeId) ? ElementHelper.upsert(propsAsArray, T.id, 
edgeId) : propsAsArray;
+
+edgeOutVertex.addEdge(null == edgeLabel ? 
Edge.DEFAULT_LABEL : edgeLabel, edgeInVertex, propsReady);
 
 if (supportsTx && counter.incrementAndGet() % 
batchSize == 0)
 graphToWriteTo.tx().commit();
@@ -292,7 +292,7 @@ public final class GraphMLReader implements GraphReader {
 
 private static Vertex findOrCreate(final Object id, final Graph 
graphToWriteTo,
final Graph.Features.VertexFeatures 
features,
-   final Map cache, final 
boolean asVertex, final Object... args) {
+   final Map cache, final 
boolean asVertex, final Object... args) {
 if (cache.containsKey(id)) {
 // if the request to findOrCreate come from a vertex then AND the 
vertex was already created, that means
 // that the vertex was created by an edge that arrived first in 
the stream (allowable via GraphML

[3/4] tinkerpop git commit: Updated changelog CTR

2017-03-10 Thread spmallette
Updated changelog CTR


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

Branch: refs/heads/master
Commit: 60a3fb33e33245f2ad9f3b1494d349c7ccf482b5
Parents: 61a3d12
Author: Stephen Mallette 
Authored: Fri Mar 10 06:30:27 2017 -0500
Committer: Stephen Mallette 
Committed: Fri Mar 10 06:30:27 2017 -0500

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


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/60a3fb33/CHANGELOG.asciidoc
--
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 04541d6..6861d57 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ 
image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.2.5 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~
 
+* Fixed an `NullPointerException` in `GraphMLReader` that occurred when an 
`` didn't have an ID field and the base graph supported ID assignment.
 * Split `ComputerVerificationStrategy` into two strategies: 
`ComputerVerificationStrategy` and `ComputerFinalizationStrategy`.
 * Removed `HasTest.g_V_hasId_compilationEquality` from process test suite as 
it makes too many assumptions about provider compilation.
 * Deprecated `CustomizerProvider` infrastructure.



tinkerpop git commit: Updated changelog CTR

2017-03-10 Thread spmallette
Repository: tinkerpop
Updated Branches:
  refs/heads/tp32 61a3d125c -> 60a3fb33e


Updated changelog CTR


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

Branch: refs/heads/tp32
Commit: 60a3fb33e33245f2ad9f3b1494d349c7ccf482b5
Parents: 61a3d12
Author: Stephen Mallette 
Authored: Fri Mar 10 06:30:27 2017 -0500
Committer: Stephen Mallette 
Committed: Fri Mar 10 06:30:27 2017 -0500

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


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/60a3fb33/CHANGELOG.asciidoc
--
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 04541d6..6861d57 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ 
image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.2.5 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~
 
+* Fixed an `NullPointerException` in `GraphMLReader` that occurred when an 
`` didn't have an ID field and the base graph supported ID assignment.
 * Split `ComputerVerificationStrategy` into two strategies: 
`ComputerVerificationStrategy` and `ComputerFinalizationStrategy`.
 * Removed `HasTest.g_V_hasId_compilationEquality` from process test suite as 
it makes too many assumptions about provider compilation.
 * Deprecated `CustomizerProvider` infrastructure.



[2/4] tinkerpop git commit: Merge branch 'tp32'

2017-03-10 Thread spmallette
Merge branch 'tp32'


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

Branch: refs/heads/master
Commit: a93bbf8fd9c76e7fa41efe45ef5ed7b2cdc432be
Parents: 1cd2403 61a3d12
Author: Stephen Mallette 
Authored: Fri Mar 10 06:28:38 2017 -0500
Committer: Stephen Mallette 
Committed: Fri Mar 10 06:28:38 2017 -0500

--
 .../structure/io/graphml/GraphMLReader.java | 19 +++--
 .../tinkerpop/gremlin/structure/io/IoTest.java  | 25 ++--
 .../structure/io/graphml/graph-no-edge-ids.xml  | 30 
 3 files changed, 62 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a93bbf8f/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoTest.java
--