You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2015/03/03 19:10:33 UTC

[1/8] incubator-tinkerpop git commit: Add test to validate that bindings clear between scripengine evaluations.

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/spark 70fc529be -> 96ffd77cc


Add test to validate that bindings clear between scripengine evaluations.

In the process cleaned up test cases that used hardcoded ids.


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

Branch: refs/heads/spark
Commit: 9bdb5e768341086172f2139c80b6a4979f0f801d
Parents: a7af852
Author: Stephen Mallette <sp...@apache.org>
Authored: Tue Mar 3 08:55:14 2015 -0500
Committer: Stephen Mallette <sp...@apache.org>
Committed: Tue Mar 3 08:55:14 2015 -0500

----------------------------------------------------------------------
 .../jsr223/GremlinGroovyScriptEngineTest.java   | 81 +++++++++++++-------
 1 file changed, 52 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/9bdb5e76/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
index 2c6d45d..0531aa9 100644
--- a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
+++ b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
@@ -18,6 +18,8 @@
  */
 package org.apache.tinkerpop.gremlin.groovy.jsr223;
 
+import groovy.lang.MissingPropertyException;
+import org.apache.commons.lang.exception.ExceptionUtils;
 import org.apache.tinkerpop.gremlin.AbstractGremlinTest;
 import org.apache.tinkerpop.gremlin.FeatureRequirementSet;
 import org.apache.tinkerpop.gremlin.LoadGraphWith;
@@ -42,7 +44,6 @@ import javax.script.CompiledScript;
 import javax.script.ScriptContext;
 import javax.script.ScriptEngine;
 import javax.script.ScriptException;
-import javax.script.SimpleBindings;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashSet;
@@ -50,11 +51,9 @@ import java.util.List;
 import java.util.Random;
 import java.util.Set;
 import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicBoolean;
 
-import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData.GRATEFUL;
 import static org.junit.Assert.*;
 
 /**
@@ -63,19 +62,19 @@ import static org.junit.Assert.*;
 public class GremlinGroovyScriptEngineTest extends AbstractGremlinTest {
 
     @Test
-    @LoadGraphWith(LoadGraphWith.GraphData.CLASSIC)
+    @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
     public void shouldDoSomeGremlin() throws Exception {
         final ScriptEngine engine = new GremlinGroovyScriptEngine();
         final List list = new ArrayList();
         engine.put("g", g);
         engine.put("temp", list);
         assertEquals(list.size(), 0);
-        engine.eval("g.V(1).out().fill(temp)");
+        engine.eval("g.V(" + convertToVertexId("marko") +").out().fill(temp)");
         assertEquals(list.size(), 3);
     }
 
     @Test
-    @LoadGraphWith(LoadGraphWith.GraphData.CLASSIC)
+    @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
     public void shouldLoadImports() throws Exception {
         final ScriptEngine engineNoImports = new GremlinGroovyScriptEngine(new NoImportCustomizerProvider());
         try {
@@ -96,7 +95,7 @@ public class GremlinGroovyScriptEngineTest extends AbstractGremlinTest {
 
 
     @Test
-    @LoadGraphWith(LoadGraphWith.GraphData.CLASSIC)
+    @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
     public void shouldLoadStandardImportsAndThenAddToThem() throws Exception {
         final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(new DefaultImportCustomizerProvider());
         engine.put("g", g);
@@ -204,7 +203,7 @@ public class GremlinGroovyScriptEngineTest extends AbstractGremlinTest {
     public void shouldProperlyHandleBindings() throws Exception {
         final ScriptEngine engine = new GremlinGroovyScriptEngine();
         engine.put("g", g);
-        Assert.assertEquals(g.V(1).next(), engine.eval("g.V(1).next()"));
+        Assert.assertEquals(g.V(convertToVertexId("marko")).next(), engine.eval("g.V(" + convertToVertexId("marko") + ").next()"));
 
         final Bindings bindings = engine.createBindings();
         bindings.put("g", g);
@@ -215,16 +214,40 @@ public class GremlinGroovyScriptEngineTest extends AbstractGremlinTest {
         bindings.put("l", 100l);
         bindings.put("d", 1.55555d);
 
-        Assert.assertEquals(engine.eval("g.E().has('weight',f).next()", bindings), g.E(7).next());
-        Assert.assertEquals(engine.eval("g.V().has('name',s).next()", bindings), g.V(1).next());
-        Assert.assertEquals(engine.eval("g.V().sideEffect{it.get().property('bbb',it.get().value('name')=='marko')}.iterate();g.V().has('bbb',b).next()", bindings), g.V(1).next());
-        Assert.assertEquals(engine.eval("g.V().sideEffect{it.get().property('iii',it.get().value('name')=='marko'?1:0)}.iterate();g.V().has('iii',i).next()", bindings), g.V(1).next());
-        Assert.assertEquals(engine.eval("g.V().sideEffect{it.get().property('lll',it.get().value('name')=='marko'?100l:0l)}.iterate();g.V().has('lll',l).next()", bindings), g.V(1).next());
-        Assert.assertEquals(engine.eval("g.V().sideEffect{it.get().property('ddd',it.get().value('name')=='marko'?1.55555d:0)}.iterate();g.V().has('ddd',d).next()", bindings), g.V(1).next());
+        assertEquals(engine.eval("g.E().has('weight',f).next()", bindings), g.E(convertToEdgeId("marko", "knows", "vadas")).next());
+        assertEquals(engine.eval("g.V().has('name',s).next()", bindings), g.V(convertToVertexId("marko")).next());
+        assertEquals(engine.eval("g.V().sideEffect{it.get().property('bbb',it.get().value('name')=='marko')}.iterate();g.V().has('bbb',b).next()", bindings), g.V(convertToVertexId("marko")).next());
+        assertEquals(engine.eval("g.V().sideEffect{it.get().property('iii',it.get().value('name')=='marko'?1:0)}.iterate();g.V().has('iii',i).next()", bindings), g.V(convertToVertexId("marko")).next());
+        assertEquals(engine.eval("g.V().sideEffect{it.get().property('lll',it.get().value('name')=='marko'?100l:0l)}.iterate();g.V().has('lll',l).next()", bindings), g.V(convertToVertexId("marko")).next());
+        assertEquals(engine.eval("g.V().sideEffect{it.get().property('ddd',it.get().value('name')=='marko'?1.55555d:0)}.iterate();g.V().has('ddd',d).next()", bindings), g.V(convertToVertexId("marko")).next());
     }
 
     @Test
-    @LoadGraphWith(LoadGraphWith.GraphData.CLASSIC)
+    @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
+    public void shouldClearBindingsBetweenEvals() throws Exception {
+        final ScriptEngine engine = new GremlinGroovyScriptEngine();
+        engine.put("g", g);
+        Assert.assertEquals(g.V(convertToVertexId("marko")).next(), engine.eval("g.V(" + convertToVertexId("marko") + ").next()"));
+
+        final Bindings bindings = engine.createBindings();
+        bindings.put("g", g);
+        bindings.put("s", "marko");
+
+        assertEquals(engine.eval("g.V().has('name',s).next()", bindings), g.V(convertToVertexId("marko")).next());
+
+        try {
+            engine.eval("g.V().has('name',s).next()");
+            fail("This should have failed because s is no longer bound");
+        } catch (Exception ex) {
+            final Throwable t = ExceptionUtils.getRootCause(ex);
+            assertEquals(MissingPropertyException.class, t.getClass());
+            assertTrue(t.getMessage().startsWith("No such property: s for class"));
+        }
+
+    }
+
+    @Test
+    @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
     public void shouldBeThreadSafe() throws Exception {
         final ScriptEngine engine = new GremlinGroovyScriptEngine();
 
@@ -257,7 +280,7 @@ public class GremlinGroovyScriptEngineTest extends AbstractGremlinTest {
     }
 
     @Test
-    @LoadGraphWith(LoadGraphWith.GraphData.CLASSIC)
+    @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
     public void shouldBeThreadSafeOnCompiledScript() throws Exception {
         final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine();
         final CompiledScript script = engine.compile("t = g.V().has('name',name); if(t.hasNext()) { t } else { null }");
@@ -292,7 +315,7 @@ public class GremlinGroovyScriptEngineTest extends AbstractGremlinTest {
     }
 
     @Test
-    @LoadGraphWith(LoadGraphWith.GraphData.CLASSIC)
+    @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
     public void shouldEvalGlobalClosuresEvenAfterEvictionOfClass() throws ScriptException {
         final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine();
 
@@ -301,14 +324,14 @@ public class GremlinGroovyScriptEngineTest extends AbstractGremlinTest {
 
         // strong referenced global closure
         engine.eval("def isVadas(v){v.value('name')=='vadas'}", bindings);
-        assertEquals(true, engine.eval("isVadas(g.V(2).next())", bindings));
+        assertEquals(true, engine.eval("isVadas(g.V(" + convertToVertexId("vadas") + ").next())", bindings));
 
         // phantom referenced global closure
         bindings.put(GremlinGroovyScriptEngine.KEY_REFERENCE_TYPE, GremlinGroovyScriptEngine.REFERENCE_TYPE_PHANTOM);
         engine.eval("def isMarko(v){v.value('name')=='marko'}", bindings);
 
         try {
-            engine.eval("isMarko(g.V(1).next())", bindings);
+            engine.eval("isMarko(g.V(" + convertToVertexId("marko") + ").next())", bindings);
             fail("the isMarko function should not be present");
         } catch (Exception ex) {
 
@@ -317,7 +340,7 @@ public class GremlinGroovyScriptEngineTest extends AbstractGremlinTest {
         assertEquals(true, engine.eval("def isMarko(v){v.value('name')=='marko'}; isMarko(g.V(1).next())", bindings));
 
         try {
-            engine.eval("isMarko(g.V(1).next())", bindings);
+            engine.eval("isMarko(g.V(" + convertToVertexId("marko") + ").next())", bindings);
             fail("the isMarko function should not be present");
         } catch (Exception ex) {
 
@@ -326,11 +349,11 @@ public class GremlinGroovyScriptEngineTest extends AbstractGremlinTest {
         bindings.remove(GremlinGroovyScriptEngine.KEY_REFERENCE_TYPE);
 
         // isVadas class was a hard reference so it should still be hanging about
-        assertEquals(true, engine.eval("isVadas(g.V(2).next())", bindings));
+        assertEquals(true, engine.eval("isVadas(g.V(" + convertToVertexId("vadas") + ").next())", bindings));
     }
 
     @Test
-    @LoadGraphWith(LoadGraphWith.GraphData.CLASSIC)
+    @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
     public void shouldAllowFunctionsUsedInClosure() throws ScriptException {
         final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine();
 
@@ -340,14 +363,14 @@ public class GremlinGroovyScriptEngineTest extends AbstractGremlinTest {
 
         // this works on its own when the function and the line that uses it is in one "script".  this is the
         // current workaround
-        assertEquals(g.V(2).next(), engine.eval("def isVadas(v){v.value('name')=='vadas'};g.V().filter{isVadas(it.get())}.next()", bindings));
+        assertEquals(g.V(convertToVertexId("vadas")).next(), engine.eval("def isVadas(v){v.value('name')=='vadas'};g.V().filter{isVadas(it.get())}.next()", bindings));
 
         // let's reset this piece and make sure isVadas is not hanging around.
         engine.reset();
 
         // validate that isVadas throws an exception since it is not defined
         try {
-            engine.eval("isVadas(g.V(2).next())", bindings);
+            engine.eval("isVadas(g.V(" + convertToVertexId("vadas") + ").next())", bindings);
 
             // fail the test if the above doesn't throw an exception
             fail();
@@ -360,10 +383,10 @@ public class GremlinGroovyScriptEngineTest extends AbstractGremlinTest {
         engine.eval("def isVadas(v){v.value('name')=='vadas'}", bindings);
 
         // make sure the function works on its own...no problem
-        assertEquals(true, engine.eval("isVadas(g.V(2).next())", bindings));
+        assertEquals(true, engine.eval("isVadas(g.V(" + convertToVertexId("vadas") + ").next())", bindings));
 
         // make sure the function works in a closure...this generates a StackOverflowError
-        assertEquals(g.V(2).next(), engine.eval("g.V().filter{isVadas(it.get())}.next()", bindings));
+        assertEquals(g.V(convertToVertexId("vadas")).next(), engine.eval("g.V().filter{isVadas(it.get())}.next()", bindings));
     }
 
     @Test
@@ -376,14 +399,14 @@ public class GremlinGroovyScriptEngineTest extends AbstractGremlinTest {
         bindings.put("g", g);
 
         // works when it's all defined together
-        assertEquals(true, engine.eval("class c { static def isVadas(v){v.value('name')=='vadas'}};c.isVadas(g.V(2).next())", bindings));
+        assertEquals(true, engine.eval("class c { static def isVadas(v){v.value('name')=='vadas'}};c.isVadas(g.V(" + convertToVertexId("vadas") + ").next())", bindings));
 
         // let's reset this piece and make sure isVadas is not hanging around.
         engine.reset();
 
         // validate that isVadas throws an exception since it is not defined
         try {
-            engine.eval("c.isVadas(g.V(2).next())", bindings);
+            engine.eval("c.isVadas(g.V(" + convertToVertexId("vadas") + ").next())", bindings);
 
             // fail the test if the above doesn't throw an exception
             fail("Function should be gone");
@@ -402,7 +425,7 @@ public class GremlinGroovyScriptEngineTest extends AbstractGremlinTest {
         engine.eval("class c { static def isVadas(v){v.name=='vadas'}};null;", bindings);
 
         // make sure the class works on its own...this generates: groovy.lang.MissingPropertyException: No such property: c for class: Script2
-        assertEquals(true, engine.eval("c.isVadas(g.V(2).next())", bindings));
+        assertEquals(true, engine.eval("c.isVadas(g.V(" + convertToVertexId("vadas") + ").next())", bindings));
     }
 
     @Test


[2/8] incubator-tinkerpop git commit: Renamed Gremlin Kryo to simply Gryo.

Posted by ok...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordReaderWriterTest.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordReaderWriterTest.java b/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordReaderWriterTest.java
new file mode 100644
index 0000000..bf03e68
--- /dev/null
+++ b/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordReaderWriterTest.java
@@ -0,0 +1,113 @@
+/*
+ * 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.hadoop.structure.io.gryo;
+
+import org.apache.tinkerpop.gremlin.hadoop.HadoopGraphProvider;
+import org.apache.tinkerpop.gremlin.hadoop.structure.io.VertexWritable;
+import org.apache.tinkerpop.gremlin.structure.Property;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.LocalFileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.io.NullWritable;
+import org.apache.hadoop.mapreduce.RecordReader;
+import org.apache.hadoop.mapreduce.RecordWriter;
+import org.apache.hadoop.mapreduce.TaskAttemptContext;
+import org.apache.hadoop.mapreduce.TaskAttemptID;
+import org.apache.hadoop.mapreduce.lib.input.FileSplit;
+import org.apache.hadoop.util.ReflectionUtils;
+import org.junit.Test;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.File;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * @author Joshua Shinavier (http://fortytwo.net)
+ */
+public class GryoRecordReaderWriterTest {
+    @Test
+    public void testAll() throws Exception {
+        Configuration conf = new Configuration(false);
+        conf.set("fs.file.impl", LocalFileSystem.class.getName());
+        conf.set("fs.default.name", "file:///");
+
+        File testFile = new File(HadoopGraphProvider.PATHS.get("grateful-dead-vertices.kryo"));
+        FileSplit split = new FileSplit(
+                new Path(testFile.getAbsoluteFile().toURI().toString()), 0,
+                testFile.length(), null);
+        System.out.println("reading Gryo file " + testFile.getAbsolutePath() + " (" + testFile.length() + " bytes)");
+
+        GryoInputFormat inputFormat = ReflectionUtils.newInstance(GryoInputFormat.class, conf);
+        TaskAttemptContext job = new TaskAttemptContext(conf, new TaskAttemptID());
+        RecordReader reader = inputFormat.createRecordReader(split, job);
+
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        try (DataOutputStream dos = new DataOutputStream(bos)) {
+            GryoOutputFormat outputFormat = new GryoOutputFormat();
+            RecordWriter writer = outputFormat.getRecordWriter(job, dos);
+
+            float lastProgress = -1f;
+            int count = 0;
+            boolean foundKeyValue = false;
+            while (reader.nextKeyValue()) {
+                //System.out.println("" + reader.getProgress() + "> " + reader.getCurrentKey() + ": " + reader.getCurrentValue());
+                count++;
+                float progress = reader.getProgress();
+                assertTrue(progress >= lastProgress);
+                assertEquals(NullWritable.class, reader.getCurrentKey().getClass());
+                VertexWritable v = (VertexWritable) reader.getCurrentValue();
+                writer.write(NullWritable.get(), v);
+
+                Vertex vertex = v.get();
+                assertEquals(Integer.class, vertex.id().getClass());
+
+                Object value = vertex.property("name");
+                if (null != value && ((Property) value).value().equals("SUGAR MAGNOLIA")) {
+                    foundKeyValue = true;
+                    assertEquals(92, count(vertex.outE().toList()));
+                    assertEquals(77, count(vertex.inE().toList()));
+                }
+
+                lastProgress = progress;
+            }
+            assertEquals(808, count);
+            assertTrue(foundKeyValue);
+        }
+
+        //System.out.println("bos: " + new String(bos.toByteArray()));
+        String[] lines = new String(bos.toByteArray()).split("\\x3a\\x15.\\x11\\x70...");
+        assertEquals(808, lines.length);
+        String line42 = lines[41];
+        //System.out.println("line42: " + line42);
+        assertTrue(line42.contains("ITS ALL OVER NO"));
+    }
+
+    private <T> long count(final Iterable<T> iter) {
+        long count = 0;
+        for (T anIter : iter) {
+            count++;
+        }
+
+        return count;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/kryo/KryoRecordReaderWriterTest.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/kryo/KryoRecordReaderWriterTest.java b/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/kryo/KryoRecordReaderWriterTest.java
deleted file mode 100644
index ed77145..0000000
--- a/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/kryo/KryoRecordReaderWriterTest.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.hadoop.structure.io.kryo;
-
-import org.apache.tinkerpop.gremlin.hadoop.HadoopGraphProvider;
-import org.apache.tinkerpop.gremlin.hadoop.structure.io.VertexWritable;
-import org.apache.tinkerpop.gremlin.structure.Property;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.LocalFileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.io.NullWritable;
-import org.apache.hadoop.mapreduce.RecordReader;
-import org.apache.hadoop.mapreduce.RecordWriter;
-import org.apache.hadoop.mapreduce.TaskAttemptContext;
-import org.apache.hadoop.mapreduce.TaskAttemptID;
-import org.apache.hadoop.mapreduce.lib.input.FileSplit;
-import org.apache.hadoop.util.ReflectionUtils;
-import org.junit.Test;
-
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.io.File;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- * @author Joshua Shinavier (http://fortytwo.net)
- */
-public class KryoRecordReaderWriterTest {
-    @Test
-    public void testAll() throws Exception {
-        Configuration conf = new Configuration(false);
-        conf.set("fs.file.impl", LocalFileSystem.class.getName());
-        conf.set("fs.default.name", "file:///");
-
-        File testFile = new File(HadoopGraphProvider.PATHS.get("grateful-dead-vertices.gio"));
-        FileSplit split = new FileSplit(
-                new Path(testFile.getAbsoluteFile().toURI().toString()), 0,
-                testFile.length(), null);
-        System.out.println("reading Gremlin Kryo file " + testFile.getAbsolutePath() + " (" + testFile.length() + " bytes)");
-
-        KryoInputFormat inputFormat = ReflectionUtils.newInstance(KryoInputFormat.class, conf);
-        TaskAttemptContext job = new TaskAttemptContext(conf, new TaskAttemptID());
-        RecordReader reader = inputFormat.createRecordReader(split, job);
-
-        ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(bos)) {
-            KryoOutputFormat outputFormat = new KryoOutputFormat();
-            RecordWriter writer = outputFormat.getRecordWriter(job, dos);
-
-            float lastProgress = -1f;
-            int count = 0;
-            boolean foundKeyValue = false;
-            while (reader.nextKeyValue()) {
-                //System.out.println("" + reader.getProgress() + "> " + reader.getCurrentKey() + ": " + reader.getCurrentValue());
-                count++;
-                float progress = reader.getProgress();
-                assertTrue(progress >= lastProgress);
-                assertEquals(NullWritable.class, reader.getCurrentKey().getClass());
-                VertexWritable v = (VertexWritable) reader.getCurrentValue();
-                writer.write(NullWritable.get(), v);
-
-                Vertex vertex = v.get();
-                assertEquals(Integer.class, vertex.id().getClass());
-
-                Object value = vertex.property("name");
-                if (null != value && ((Property) value).value().equals("SUGAR MAGNOLIA")) {
-                    foundKeyValue = true;
-                    assertEquals(92, count(vertex.outE().toList()));
-                    assertEquals(77, count(vertex.inE().toList()));
-                }
-
-                lastProgress = progress;
-            }
-            assertEquals(808, count);
-            assertTrue(foundKeyValue);
-        }
-
-        //System.out.println("bos: " + new String(bos.toByteArray()));
-        String[] lines = new String(bos.toByteArray()).split("\\x3a\\x15.\\x11\\x70...");
-        assertEquals(808, lines.length);
-        String line42 = lines[41];
-        //System.out.println("line42: " + line42);
-        assertTrue(line42.contains("ITS ALL OVER NO"));
-    }
-
-    private <T> long count(final Iterable<T> iter) {
-        long count = 0;
-        for (T anIter : iter) {
-            count++;
-        }
-
-        return count;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 30666dd..8acac72 100644
--- a/pom.xml
+++ b/pom.xml
@@ -216,7 +216,7 @@ limitations under the License.
                         <exclude>docs/static/**</exclude>
                         <exclude>docs/stylesheets/**</exclude>
                         <exclude>**/target/**</exclude>
-                        <exclude>**/*.gio</exclude>
+                        <exclude>**/*.kryo</exclude>
                         <exclude>**/*.iml</exclude>
                         <exclude>**/*.json</exclude>
                         <exclude>**/*.xml</exclude>

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/tinkergraph-gremlin/pom.xml
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/pom.xml b/tinkergraph-gremlin/pom.xml
index 05c7214..7361bd3 100644
--- a/tinkergraph-gremlin/pom.xml
+++ b/tinkergraph-gremlin/pom.xml
@@ -128,19 +128,19 @@ limitations under the License.
                                 </goals>
                                 <configuration>
                                     <outputDirectory>
-                                        ../gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo
+                                        ../gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo
                                     </outputDirectory>
                                     <resources>
                                         <resource>
                                             <directory>${io.tmp.dir}</directory>
                                             <filtering>false</filtering>
                                             <includes>
-                                                <include>**/*.gio</include>
+                                                <include>**/*.kryo</include>
                                             </includes>
                                         </resource>
                                     </resources>
                                     <nonFilteredFileExtensions>
-                                        <nonFilteredFileExtension>gio</nonFilteredFileExtension>
+                                        <nonFilteredFileExtension>kryo</nonFilteredFileExtension>
                                     </nonFilteredFileExtensions>
                                 </configuration>
                             </execution>

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
index 2ce857d..fdea748 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
@@ -29,8 +29,8 @@ import org.apache.tinkerpop.gremlin.structure.io.GraphReader;
 import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLWriter;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter;
-import org.apache.tinkerpop.gremlin.structure.io.kryo.KryoReader;
-import org.apache.tinkerpop.gremlin.structure.io.kryo.KryoWriter;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter;
 import org.apache.tinkerpop.gremlin.util.StreamFactory;
 import org.junit.BeforeClass;
 import org.junit.Ignore;
@@ -39,7 +39,6 @@ import org.junit.Test;
 import java.io.*;
 import java.util.Arrays;
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
 import java.util.function.Supplier;
 
@@ -198,9 +197,9 @@ public class TinkerGraphTest {
      * No assertions.  Just write out the graph for convenience.
      */
     @Test
-    public void shouldWriteClassicGraphAsKryo() throws IOException {
-        final OutputStream os = new FileOutputStream(tempPath + "tinkerpop-classic.gio");
-        KryoWriter.build().create().writeGraph(os, TinkerFactory.createClassic());
+    public void shouldWriteClassicGraphAsGryo() throws IOException {
+        final OutputStream os = new FileOutputStream(tempPath + "tinkerpop-classic.kryo");
+        GryoWriter.build().create().writeGraph(os, TinkerFactory.createClassic());
         os.close();
     }
 
@@ -208,9 +207,9 @@ public class TinkerGraphTest {
      * No assertions.  Just write out the graph for convenience.
      */
     @Test
-    public void shouldWriteModernGraphAsKryo() throws IOException {
-        final OutputStream os = new FileOutputStream(tempPath + "tinkerpop-modern.gio");
-        KryoWriter.build().create().writeGraph(os, TinkerFactory.createModern());
+    public void shouldWriteModernGraphAsGryo() throws IOException {
+        final OutputStream os = new FileOutputStream(tempPath + "tinkerpop-modern.kryo");
+        GryoWriter.build().create().writeGraph(os, TinkerFactory.createModern());
         os.close();
     }
 
@@ -218,9 +217,9 @@ public class TinkerGraphTest {
      * No assertions.  Just write out the graph for convenience.
      */
     @Test
-    public void shouldWriteCrewGraphAsKryo() throws IOException {
-        final OutputStream os = new FileOutputStream(tempPath + "tinkerpop-crew.gio");
-        KryoWriter.build().create().writeGraph(os, TinkerFactory.createTheCrew());
+    public void shouldWriteCrewGraphAsGryo() throws IOException {
+        final OutputStream os = new FileOutputStream(tempPath + "tinkerpop-crew.kryo");
+        GryoWriter.build().create().writeGraph(os, TinkerFactory.createTheCrew());
         os.close();
     }
 
@@ -228,9 +227,9 @@ public class TinkerGraphTest {
      * No assertions.  Just write out the graph for convenience.
      */
     @Test
-    public void shouldWriteClassicVerticesAsKryo() throws IOException {
-        final OutputStream os = new FileOutputStream(tempPath + "tinkerpop-classic-vertices.gio");
-        KryoWriter.build().create().writeVertices(os, TinkerFactory.createClassic().V(), Direction.BOTH);
+    public void shouldWriteClassicVerticesAsGryo() throws IOException {
+        final OutputStream os = new FileOutputStream(tempPath + "tinkerpop-classic-vertices.kryo");
+        GryoWriter.build().create().writeVertices(os, TinkerFactory.createClassic().V(), Direction.BOTH);
         os.close();
     }
 
@@ -248,9 +247,9 @@ public class TinkerGraphTest {
      * No assertions.  Just write out the graph for convenience.
      */
     @Test
-    public void shouldWriteModernVerticesAsKryo() throws IOException {
-        final OutputStream os = new FileOutputStream(tempPath + "tinkerpop-modern-vertices.gio");
-        KryoWriter.build().create().writeVertices(os, TinkerFactory.createModern().V(), Direction.BOTH);
+    public void shouldWriteModernVerticesAsGryo() throws IOException {
+        final OutputStream os = new FileOutputStream(tempPath + "tinkerpop-modern-vertices.kryo");
+        GryoWriter.build().create().writeVertices(os, TinkerFactory.createModern().V(), Direction.BOTH);
         os.close();
     }
 
@@ -268,9 +267,9 @@ public class TinkerGraphTest {
      * No assertions.  Just write out the graph for convenience.
      */
     @Test
-    public void shouldWriteCrewVerticesAsKryo() throws IOException {
-        final OutputStream os = new FileOutputStream(tempPath + "tinkerpop-crew-vertices.gio");
-        KryoWriter.build().create().writeVertices(os, TinkerFactory.createTheCrew().V(), Direction.BOTH);
+    public void shouldWriteCrewVerticesAsGryo() throws IOException {
+        final OutputStream os = new FileOutputStream(tempPath + "tinkerpop-crew-vertices.kryo");
+        GryoWriter.build().create().writeVertices(os, TinkerFactory.createTheCrew().V(), Direction.BOTH);
         os.close();
     }
 
@@ -612,12 +611,12 @@ public class TinkerGraphTest {
     @Test
     public void shouldWriteGratefulDead() throws IOException {
         final Graph g = TinkerGraph.open();
-        final GraphReader reader = KryoReader.build().create();
-        try (final InputStream stream = AbstractGremlinTest.class.getResourceAsStream("/org/apache/tinkerpop/gremlin/structure/io/kryo/grateful-dead.gio")) {
+        final GraphReader reader = GryoReader.build().create();
+        try (final InputStream stream = AbstractGremlinTest.class.getResourceAsStream("/org/apache/tinkerpop/gremlin/structure/io/gryo/grateful-dead.kryo")) {
             reader.readGraph(stream, g);
         }
 
-        /* keep this hanging around because changes to kryo format will need grateful dead generated from json so you can generate the gio
+        /* keep this hanging around because changes to gryo format will need grateful dead generated from json so you can generate the gio
         final GraphReader reader = GraphSONReader.build().embedTypes(true).create();
         try (final InputStream stream = AbstractGremlinTest.class.getResourceAsStream("/org/apache/tinkerpop/gremlin/structure/io/graphson/grateful-dead.json")) {
             reader.readGraph(stream, g);
@@ -651,8 +650,8 @@ public class TinkerGraphTest {
 
         }).iterate();
 
-        final OutputStream os = new FileOutputStream(tempPath + "grateful-dead.gio");
-        KryoWriter.build().create().writeGraph(os, ng);
+        final OutputStream os = new FileOutputStream(tempPath + "grateful-dead.kryo");
+        GryoWriter.build().create().writeGraph(os, ng);
         os.close();
 
         final OutputStream os2 = new FileOutputStream(tempPath + "grateful-dead.json");
@@ -663,8 +662,8 @@ public class TinkerGraphTest {
         GraphMLWriter.build().create().writeGraph(os3, g);
         os3.close();
 
-        final OutputStream os4 = new FileOutputStream(tempPath + "grateful-dead-vertices.gio");
-        KryoWriter.build().create().writeVertices(os4, g.V(), Direction.BOTH);
+        final OutputStream os4 = new FileOutputStream(tempPath + "grateful-dead-vertices.kryo");
+        GryoWriter.build().create().writeVertices(os4, g.V(), Direction.BOTH);
         os.close();
 
         final OutputStream os5 = new FileOutputStream(tempPath + "grateful-dead-vertices.ldjson");


[4/8] incubator-tinkerpop git commit: Renamed Gremlin Kryo to simply Gryo.

Posted by ok...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1D0Test.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1D0Test.java b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1D0Test.java
new file mode 100644
index 0000000..158039a
--- /dev/null
+++ b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1D0Test.java
@@ -0,0 +1,294 @@
+/*
+ * 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.driver.ser;
+
+import org.apache.tinkerpop.gremlin.driver.MessageSerializer;
+import org.apache.tinkerpop.gremlin.driver.message.ResponseMessage;
+import org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode;
+import org.apache.tinkerpop.gremlin.structure.Compare;
+import org.apache.tinkerpop.gremlin.structure.Direction;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
+import org.apache.tinkerpop.gremlin.util.StreamFactory;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.ByteBufAllocator;
+import io.netty.buffer.UnpooledByteBufAllocator;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+/**
+ * Serializer tests that cover non-lossy serialization/deserialization methods.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class GryoMessageSerializerV1D0Test {
+    private static final Map<String, Object> config = new HashMap<String, Object>() {{
+        put("serializeResultToString", true);
+    }};
+
+    private UUID requestId = UUID.fromString("6457272A-4018-4538-B9AE-08DD5DDC0AA1");
+    private ResponseMessage.Builder responseMessageBuilder = ResponseMessage.build(requestId);
+    private static ByteBufAllocator allocator = UnpooledByteBufAllocator.DEFAULT;
+
+    public MessageSerializer binarySerializer = new GryoMessageSerializerV1d0();
+
+    public MessageSerializer textSerializer = new GryoMessageSerializerV1d0();
+
+    public GryoMessageSerializerV1D0Test() {
+        textSerializer.configure(config, null);
+    }
+
+    @Test
+    public void serializeIterable() throws Exception {
+        final ArrayList<Integer> list = new ArrayList<>();
+        list.add(1);
+        list.add(100);
+
+        final ResponseMessage response = convertBinary(list);
+        assertCommon(response);
+
+        final List<Integer> deserializedFunList = (List<Integer>) response.getResult().getData();
+        assertEquals(2, deserializedFunList.size());
+        assertEquals(new Integer(1), deserializedFunList.get(0));
+        assertEquals(new Integer(100), deserializedFunList.get(1));
+    }
+
+    @Test
+    public void serializeIterableToString() throws Exception {
+        final ArrayList<Integer> list = new ArrayList<>();
+        list.add(1);
+        list.add(100);
+
+        final ResponseMessage response = convertText(list);
+        assertCommon(response);
+
+        final List deserializedFunList = (List) response.getResult().getData();
+        assertEquals(2, deserializedFunList.size());
+        assertEquals("1", deserializedFunList.get(0));
+        assertEquals("100", deserializedFunList.get(1));
+    }
+
+    @Test
+    public void serializeIterableToStringWithNull() throws Exception {
+        final ArrayList<Integer> list = new ArrayList<>();
+        list.add(1);
+        list.add(null);
+        list.add(100);
+
+        final ResponseMessage response = convertText(list);
+        assertCommon(response);
+
+        final List deserializedFunList = (List) response.getResult().getData();
+        assertEquals(3, deserializedFunList.size());
+        assertEquals("1", deserializedFunList.get(0).toString());
+        assertEquals("null", deserializedFunList.get(1).toString());
+        assertEquals("100", deserializedFunList.get(2).toString());
+    }
+
+    @Test
+    public void serializeIterableWithNull() throws Exception {
+        final ArrayList<Integer> list = new ArrayList<>();
+        list.add(1);
+        list.add(null);
+        list.add(100);
+
+        final ResponseMessage response = convertBinary(list);
+        assertCommon(response);
+
+        final List<Integer> deserializedFunList = (List<Integer>) response.getResult().getData();
+        assertEquals(3, deserializedFunList.size());
+        assertEquals(new Integer(1), deserializedFunList.get(0));
+        assertNull(deserializedFunList.get(1));
+        assertEquals(new Integer(100), deserializedFunList.get(2));
+    }
+
+    @Test
+    public void serializeMap() throws Exception {
+        final Map<String, Object> map = new HashMap<>();
+        final Map<String, String> innerMap = new HashMap<>();
+        innerMap.put("a", "b");
+
+        map.put("x", 1);
+        map.put("y", "some");
+        map.put("z", innerMap);
+
+        final ResponseMessage response = convertBinary(map);
+        assertCommon(response);
+
+        final Map<String, Object> deserializedMap = (Map<String, Object>) response.getResult().getData();
+        assertEquals(3, deserializedMap.size());
+        assertEquals(1, deserializedMap.get("x"));
+        assertEquals("some", deserializedMap.get("y"));
+
+        final Map<String, String> deserializedInnerMap = (Map<String, String>) deserializedMap.get("z");
+        assertEquals(1, deserializedInnerMap.size());
+        assertEquals("b", deserializedInnerMap.get("a"));
+    }
+
+    @Test
+    public void serializeEdge() throws Exception {
+        final Graph g = TinkerGraph.open();
+        final Vertex v1 = g.addVertex();
+        final Vertex v2 = g.addVertex();
+        final Edge e = v1.addEdge("test", v2);
+        e.property("abc", 123);
+
+        final Iterable<Edge> iterable = g.E().toList();
+
+        final ResponseMessage response = convertBinary(iterable);
+        assertCommon(response);
+
+        final List<DetachedEdge> edgeList = (List<DetachedEdge>) response.getResult().getData();
+        assertEquals(1, edgeList.size());
+
+        final DetachedEdge deserializedEdge = edgeList.get(0);
+        assertEquals(2l, deserializedEdge.id());
+        assertEquals("test", deserializedEdge.label());
+
+        assertEquals(new Integer(123), (Integer) deserializedEdge.value("abc"));
+        assertEquals(1, StreamFactory.stream(deserializedEdge.iterators().propertyIterator()).count());
+        assertEquals(0l, deserializedEdge.iterators().vertexIterator(Direction.OUT).next().id());
+        assertEquals(Vertex.DEFAULT_LABEL, deserializedEdge.iterators().vertexIterator(Direction.OUT).next().label());
+        assertEquals(1l, deserializedEdge.iterators().vertexIterator(Direction.IN).next().id());
+        assertEquals(Vertex.DEFAULT_LABEL, deserializedEdge.iterators().vertexIterator(Direction.IN).next().label());
+    }
+
+    @Test
+    public void serializeVertexWithEmbeddedMap() throws Exception {
+        final Graph g = TinkerGraph.open();
+        final Vertex v = g.addVertex();
+        final Map<String, Object> map = new HashMap<>();
+        map.put("x", 500);
+        map.put("y", "some");
+
+        final ArrayList<Object> friends = new ArrayList<>();
+        friends.add("x");
+        friends.add(5);
+        friends.add(map);
+
+        v.property("friends", friends);
+
+        final List list = g.V().toList();
+
+        final ResponseMessage response = convertBinary(list);
+        assertCommon(response);
+
+        final List<DetachedVertex> vertexList = (List<DetachedVertex>) response.getResult().getData();
+        assertEquals(1, vertexList.size());
+
+        final DetachedVertex deserializedVertex = vertexList.get(0);
+        assertEquals(0l, deserializedVertex.id());
+        assertEquals(Vertex.DEFAULT_LABEL, deserializedVertex.label());
+
+        assertEquals(1, StreamFactory.stream(deserializedVertex.iterators().propertyIterator()).count());
+
+        final List<Object> deserializedInnerList = (List<Object>) deserializedVertex.iterators().valueIterator("friends").next();
+        assertEquals(3, deserializedInnerList.size());
+        assertEquals("x", deserializedInnerList.get(0));
+        assertEquals(5, deserializedInnerList.get(1));
+
+        final Map<String, Object> deserializedInnerInnerMap = (Map<String, Object>) deserializedInnerList.get(2);
+        assertEquals(2, deserializedInnerInnerMap.size());
+        assertEquals(500, deserializedInnerInnerMap.get("x"));
+        assertEquals("some", deserializedInnerInnerMap.get("y"));
+    }
+
+    @Test
+    public void serializeToMapWithElementForKey() throws Exception {
+        final TinkerGraph g = TinkerFactory.createClassic();
+        final Map<Vertex, Integer> map = new HashMap<>();
+        map.put(g.V().has("name", Compare.eq, "marko").next(), 1000);
+
+        final ResponseMessage response = convertBinary(map);
+        assertCommon(response);
+
+        final Map<Vertex, Integer> deserializedMap = (Map<Vertex, Integer>) response.getResult().getData();
+        assertEquals(1, deserializedMap.size());
+
+        final Vertex deserializedMarko = deserializedMap.keySet().iterator().next();
+        assertEquals("marko", deserializedMarko.iterators().valueIterator("name").next().toString());
+        assertEquals(1, deserializedMarko.id());
+        assertEquals(Vertex.DEFAULT_LABEL, deserializedMarko.label());
+        assertEquals(new Integer(29), (Integer) deserializedMarko.iterators().valueIterator("age").next());
+        assertEquals(2, StreamFactory.stream(deserializedMarko.iterators().propertyIterator()).count());
+
+        assertEquals(new Integer(1000), deserializedMap.values().iterator().next());
+    }
+
+    @Test
+    public void serializeFullResponseMessage() throws Exception {
+        final UUID id = UUID.randomUUID();
+
+        final Map<String, Object> metaData = new HashMap<>();
+        metaData.put("test", "this");
+        metaData.put("one", 1);
+
+        final Map<String, Object> attributes = new HashMap<>();
+        attributes.put("test", "that");
+        attributes.put("two", 2);
+
+        final ResponseMessage response = ResponseMessage.build(id)
+                .responseMetaData(metaData)
+                .code(ResponseStatusCode.SUCCESS)
+                .result("some-result")
+                .statusAttributes(attributes)
+                .statusMessage("worked")
+                .create();
+
+        final ByteBuf bb = binarySerializer.serializeResponseAsBinary(response, allocator);
+        final ResponseMessage deserialized = binarySerializer.deserializeResponse(bb);
+
+        assertEquals(id, deserialized.getRequestId());
+        assertEquals("this", deserialized.getResult().getMeta().get("test"));
+        assertEquals(1, deserialized.getResult().getMeta().get("one"));
+        assertEquals("some-result", deserialized.getResult().getData());
+        assertEquals("that", deserialized.getStatus().getAttributes().get("test"));
+        assertEquals(2, deserialized.getStatus().getAttributes().get("two"));
+        assertEquals(ResponseStatusCode.SUCCESS.getValue(), deserialized.getStatus().getCode().getValue());
+        assertEquals("worked", deserialized.getStatus().getMessage());
+    }
+
+    private void assertCommon(final ResponseMessage response) {
+        assertEquals(requestId, response.getRequestId());
+        assertEquals(ResponseStatusCode.SUCCESS, response.getStatus().getCode());
+    }
+
+    private ResponseMessage convertBinary(final Object toSerialize) throws SerializationException {
+        final ByteBuf bb = binarySerializer.serializeResponseAsBinary(responseMessageBuilder.result(toSerialize).create(), allocator);
+        return binarySerializer.deserializeResponse(bb);
+    }
+
+    private ResponseMessage convertText(final Object toSerialize) throws SerializationException {
+        final ByteBuf bb = textSerializer.serializeResponseAsBinary(responseMessageBuilder.result(toSerialize).create(), allocator);
+        return textSerializer.deserializeResponse(bb);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/KryoMessageSerializerV1d0Test.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/KryoMessageSerializerV1d0Test.java b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/KryoMessageSerializerV1d0Test.java
deleted file mode 100644
index 5514bfc..0000000
--- a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/KryoMessageSerializerV1d0Test.java
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.driver.ser;
-
-import org.apache.tinkerpop.gremlin.driver.MessageSerializer;
-import org.apache.tinkerpop.gremlin.driver.message.ResponseMessage;
-import org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode;
-import org.apache.tinkerpop.gremlin.structure.Compare;
-import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
-import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory;
-import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
-import org.apache.tinkerpop.gremlin.util.StreamFactory;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.ByteBufAllocator;
-import io.netty.buffer.UnpooledByteBufAllocator;
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-/**
- * Serializer tests that cover non-lossy serialization/deserialization methods.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class KryoMessageSerializerV1d0Test {
-    private static final Map<String, Object> config = new HashMap<String, Object>() {{
-        put("serializeResultToString", true);
-    }};
-
-    private UUID requestId = UUID.fromString("6457272A-4018-4538-B9AE-08DD5DDC0AA1");
-    private ResponseMessage.Builder responseMessageBuilder = ResponseMessage.build(requestId);
-    private static ByteBufAllocator allocator = UnpooledByteBufAllocator.DEFAULT;
-
-    public MessageSerializer binarySerializer = new KryoMessageSerializerV1d0();
-
-    public MessageSerializer textSerializer = new KryoMessageSerializerV1d0();
-
-    public KryoMessageSerializerV1d0Test() {
-        textSerializer.configure(config, null);
-    }
-
-    @Test
-    public void serializeIterable() throws Exception {
-        final ArrayList<Integer> list = new ArrayList<>();
-        list.add(1);
-        list.add(100);
-
-        final ResponseMessage response = convertBinary(list);
-        assertCommon(response);
-
-        final List<Integer> deserializedFunList = (List<Integer>) response.getResult().getData();
-        assertEquals(2, deserializedFunList.size());
-        assertEquals(new Integer(1), deserializedFunList.get(0));
-        assertEquals(new Integer(100), deserializedFunList.get(1));
-    }
-
-    @Test
-    public void serializeIterableToString() throws Exception {
-        final ArrayList<Integer> list = new ArrayList<>();
-        list.add(1);
-        list.add(100);
-
-        final ResponseMessage response = convertText(list);
-        assertCommon(response);
-
-        final List deserializedFunList = (List) response.getResult().getData();
-        assertEquals(2, deserializedFunList.size());
-        assertEquals("1", deserializedFunList.get(0));
-        assertEquals("100", deserializedFunList.get(1));
-    }
-
-    @Test
-    public void serializeIterableToStringWithNull() throws Exception {
-        final ArrayList<Integer> list = new ArrayList<>();
-        list.add(1);
-        list.add(null);
-        list.add(100);
-
-        final ResponseMessage response = convertText(list);
-        assertCommon(response);
-
-        final List deserializedFunList = (List) response.getResult().getData();
-        assertEquals(3, deserializedFunList.size());
-        assertEquals("1", deserializedFunList.get(0).toString());
-        assertEquals("null", deserializedFunList.get(1).toString());
-        assertEquals("100", deserializedFunList.get(2).toString());
-    }
-
-    @Test
-    public void serializeIterableWithNull() throws Exception {
-        final ArrayList<Integer> list = new ArrayList<>();
-        list.add(1);
-        list.add(null);
-        list.add(100);
-
-        final ResponseMessage response = convertBinary(list);
-        assertCommon(response);
-
-        final List<Integer> deserializedFunList = (List<Integer>) response.getResult().getData();
-        assertEquals(3, deserializedFunList.size());
-        assertEquals(new Integer(1), deserializedFunList.get(0));
-        assertNull(deserializedFunList.get(1));
-        assertEquals(new Integer(100), deserializedFunList.get(2));
-    }
-
-    @Test
-    public void serializeMap() throws Exception {
-        final Map<String, Object> map = new HashMap<>();
-        final Map<String, String> innerMap = new HashMap<>();
-        innerMap.put("a", "b");
-
-        map.put("x", 1);
-        map.put("y", "some");
-        map.put("z", innerMap);
-
-        final ResponseMessage response = convertBinary(map);
-        assertCommon(response);
-
-        final Map<String, Object> deserializedMap = (Map<String, Object>) response.getResult().getData();
-        assertEquals(3, deserializedMap.size());
-        assertEquals(1, deserializedMap.get("x"));
-        assertEquals("some", deserializedMap.get("y"));
-
-        final Map<String, String> deserializedInnerMap = (Map<String, String>) deserializedMap.get("z");
-        assertEquals(1, deserializedInnerMap.size());
-        assertEquals("b", deserializedInnerMap.get("a"));
-    }
-
-    @Test
-    public void serializeEdge() throws Exception {
-        final Graph g = TinkerGraph.open();
-        final Vertex v1 = g.addVertex();
-        final Vertex v2 = g.addVertex();
-        final Edge e = v1.addEdge("test", v2);
-        e.property("abc", 123);
-
-        final Iterable<Edge> iterable = g.E().toList();
-
-        final ResponseMessage response = convertBinary(iterable);
-        assertCommon(response);
-
-        final List<DetachedEdge> edgeList = (List<DetachedEdge>) response.getResult().getData();
-        assertEquals(1, edgeList.size());
-
-        final DetachedEdge deserializedEdge = edgeList.get(0);
-        assertEquals(2l, deserializedEdge.id());
-        assertEquals("test", deserializedEdge.label());
-
-        assertEquals(new Integer(123), (Integer) deserializedEdge.value("abc"));
-        assertEquals(1, StreamFactory.stream(deserializedEdge.iterators().propertyIterator()).count());
-        assertEquals(0l, deserializedEdge.iterators().vertexIterator(Direction.OUT).next().id());
-        assertEquals(Vertex.DEFAULT_LABEL, deserializedEdge.iterators().vertexIterator(Direction.OUT).next().label());
-        assertEquals(1l, deserializedEdge.iterators().vertexIterator(Direction.IN).next().id());
-        assertEquals(Vertex.DEFAULT_LABEL, deserializedEdge.iterators().vertexIterator(Direction.IN).next().label());
-    }
-
-    @Test
-    public void serializeVertexWithEmbeddedMap() throws Exception {
-        final Graph g = TinkerGraph.open();
-        final Vertex v = g.addVertex();
-        final Map<String, Object> map = new HashMap<>();
-        map.put("x", 500);
-        map.put("y", "some");
-
-        final ArrayList<Object> friends = new ArrayList<>();
-        friends.add("x");
-        friends.add(5);
-        friends.add(map);
-
-        v.property("friends", friends);
-
-        final List list = g.V().toList();
-
-        final ResponseMessage response = convertBinary(list);
-        assertCommon(response);
-
-        final List<DetachedVertex> vertexList = (List<DetachedVertex>) response.getResult().getData();
-        assertEquals(1, vertexList.size());
-
-        final DetachedVertex deserializedVertex = vertexList.get(0);
-        assertEquals(0l, deserializedVertex.id());
-        assertEquals(Vertex.DEFAULT_LABEL, deserializedVertex.label());
-
-        assertEquals(1, StreamFactory.stream(deserializedVertex.iterators().propertyIterator()).count());
-
-        final List<Object> deserializedInnerList = (List<Object>) deserializedVertex.iterators().valueIterator("friends").next();
-        assertEquals(3, deserializedInnerList.size());
-        assertEquals("x", deserializedInnerList.get(0));
-        assertEquals(5, deserializedInnerList.get(1));
-
-        final Map<String, Object> deserializedInnerInnerMap = (Map<String, Object>) deserializedInnerList.get(2);
-        assertEquals(2, deserializedInnerInnerMap.size());
-        assertEquals(500, deserializedInnerInnerMap.get("x"));
-        assertEquals("some", deserializedInnerInnerMap.get("y"));
-    }
-
-    @Test
-    public void serializeToMapWithElementForKey() throws Exception {
-        final TinkerGraph g = TinkerFactory.createClassic();
-        final Map<Vertex, Integer> map = new HashMap<>();
-        map.put(g.V().has("name", Compare.eq, "marko").next(), 1000);
-
-        final ResponseMessage response = convertBinary(map);
-        assertCommon(response);
-
-        final Map<Vertex, Integer> deserializedMap = (Map<Vertex, Integer>) response.getResult().getData();
-        assertEquals(1, deserializedMap.size());
-
-        final Vertex deserializedMarko = deserializedMap.keySet().iterator().next();
-        assertEquals("marko", deserializedMarko.iterators().valueIterator("name").next().toString());
-        assertEquals(1, deserializedMarko.id());
-        assertEquals(Vertex.DEFAULT_LABEL, deserializedMarko.label());
-        assertEquals(new Integer(29), (Integer) deserializedMarko.iterators().valueIterator("age").next());
-        assertEquals(2, StreamFactory.stream(deserializedMarko.iterators().propertyIterator()).count());
-
-        assertEquals(new Integer(1000), deserializedMap.values().iterator().next());
-    }
-
-    @Test
-    public void serializeFullResponseMessage() throws Exception {
-        final UUID id = UUID.randomUUID();
-
-        final Map<String, Object> metaData = new HashMap<>();
-        metaData.put("test", "this");
-        metaData.put("one", 1);
-
-        final Map<String, Object> attributes = new HashMap<>();
-        attributes.put("test", "that");
-        attributes.put("two", 2);
-
-        final ResponseMessage response = ResponseMessage.build(id)
-                .responseMetaData(metaData)
-                .code(ResponseStatusCode.SUCCESS)
-                .result("some-result")
-                .statusAttributes(attributes)
-                .statusMessage("worked")
-                .create();
-
-        final ByteBuf bb = binarySerializer.serializeResponseAsBinary(response, allocator);
-        final ResponseMessage deserialized = binarySerializer.deserializeResponse(bb);
-
-        assertEquals(id, deserialized.getRequestId());
-        assertEquals("this", deserialized.getResult().getMeta().get("test"));
-        assertEquals(1, deserialized.getResult().getMeta().get("one"));
-        assertEquals("some-result", deserialized.getResult().getData());
-        assertEquals("that", deserialized.getStatus().getAttributes().get("test"));
-        assertEquals(2, deserialized.getStatus().getAttributes().get("two"));
-        assertEquals(ResponseStatusCode.SUCCESS.getValue(), deserialized.getStatus().getCode().getValue());
-        assertEquals("worked", deserialized.getStatus().getMessage());
-    }
-
-    private void assertCommon(final ResponseMessage response) {
-        assertEquals(requestId, response.getRequestId());
-        assertEquals(ResponseStatusCode.SUCCESS, response.getStatus().getCode());
-    }
-
-    private ResponseMessage convertBinary(final Object toSerialize) throws SerializationException {
-        final ByteBuf bb = binarySerializer.serializeResponseAsBinary(responseMessageBuilder.result(toSerialize).create(), allocator);
-        return binarySerializer.deserializeResponse(bb);
-    }
-
-    private ResponseMessage convertText(final Object toSerialize) throws SerializationException {
-        final ByteBuf bb = textSerializer.serializeResponseAsBinary(responseMessageBuilder.result(toSerialize).create(), allocator);
-        return textSerializer.deserializeResponse(bb);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/AbstractImportCustomizerProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/AbstractImportCustomizerProvider.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/AbstractImportCustomizerProvider.java
index fc133e3..ab983e9 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/AbstractImportCustomizerProvider.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/AbstractImportCustomizerProvider.java
@@ -48,7 +48,7 @@ import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.apache.tinkerpop.gremlin.structure.io.GraphReader;
 import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLReader;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONReader;
-import org.apache.tinkerpop.gremlin.structure.io.kryo.KryoReader;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader;
 import org.apache.tinkerpop.gremlin.structure.strategy.GraphStrategy;
 import org.apache.tinkerpop.gremlin.structure.util.GraphFactory;
 import org.apache.tinkerpop.gremlin.structure.util.batch.BatchGraph;
@@ -105,7 +105,7 @@ public abstract class AbstractImportCustomizerProvider implements ImportCustomiz
         imports.add(GraphReader.class.getPackage().getName() + DOT_STAR);
         imports.add(GraphMLReader.class.getPackage().getName() + DOT_STAR);
         imports.add(GraphSONReader.class.getPackage().getName() + DOT_STAR);
-        imports.add(KryoReader.class.getPackage().getName() + DOT_STAR);
+        imports.add(GryoReader.class.getPackage().getName() + DOT_STAR);
 
         // algorithms
         imports.add(AbstractGenerator.class.getPackage().getName() + DOT_STAR);

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-server/conf/gremlin-server-classic.yaml
----------------------------------------------------------------------
diff --git a/gremlin-server/conf/gremlin-server-classic.yaml b/gremlin-server/conf/gremlin-server-classic.yaml
index c34f652..e216c1b 100644
--- a/gremlin-server/conf/gremlin-server-classic.yaml
+++ b/gremlin-server/conf/gremlin-server-classic.yaml
@@ -31,8 +31,8 @@ scriptEngines: {
     staticImports: [java.lang.Math.PI],
     scripts: [scripts/generate-classic.groovy]}}
 serializers:
-  - { className: org.apache.tinkerpop.gremlin.driver.ser.KryoMessageSerializerV1d0 }
-  - { className: org.apache.tinkerpop.gremlin.driver.ser.KryoMessageSerializerV1d0, config: { serializeResultToString: true }}
+  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0 }
+  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }}
 metrics: {
   slf4jReporter: {enabled: true, interval: 180000}}
 threadPoolBoss: 1

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-server/conf/gremlin-server-modern.yaml
----------------------------------------------------------------------
diff --git a/gremlin-server/conf/gremlin-server-modern.yaml b/gremlin-server/conf/gremlin-server-modern.yaml
index d94c3a8..940b48d 100644
--- a/gremlin-server/conf/gremlin-server-modern.yaml
+++ b/gremlin-server/conf/gremlin-server-modern.yaml
@@ -31,8 +31,8 @@ scriptEngines: {
     staticImports: [java.lang.Math.PI],
     scripts: [scripts/generate-modern.groovy]}}
 serializers:
-  - { className: org.apache.tinkerpop.gremlin.driver.ser.KryoMessageSerializerV1d0 }
-  - { className: org.apache.tinkerpop.gremlin.driver.ser.KryoMessageSerializerV1d0, config: { serializeResultToString: true }}
+  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0 }
+  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }}
 metrics: {
   slf4jReporter: {enabled: true, interval: 180000}}
 threadPoolBoss: 1

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-server/conf/gremlin-server-neo4j.yaml
----------------------------------------------------------------------
diff --git a/gremlin-server/conf/gremlin-server-neo4j.yaml b/gremlin-server/conf/gremlin-server-neo4j.yaml
index 01a68e9..0b33bdb 100644
--- a/gremlin-server/conf/gremlin-server-neo4j.yaml
+++ b/gremlin-server/conf/gremlin-server-neo4j.yaml
@@ -34,8 +34,8 @@ scriptEngines: {
       imports: [java.lang.Math],
       staticImports: [java.lang.Math.PI]}}
 serializers:
-  - { className: org.apache.tinkerpop.gremlin.driver.ser.KryoMessageSerializerV1d0 }
-  - { className: org.apache.tinkerpop.gremlin.driver.ser.KryoMessageSerializerV1d0, config: { serializeResultToString: true }}
+  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0 }
+  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }}
   - { className: org.apache.tinkerpop.gremlin.driver.ser.JsonMessageSerializerGremlinV1d0 }
 processors:
   - { className: org.apache.tinkerpop.gremlin.server.op.session.SessionOpProcessor, config: { sessionTimeout: 28800000 }}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-server/conf/gremlin-server.yaml
----------------------------------------------------------------------
diff --git a/gremlin-server/conf/gremlin-server.yaml b/gremlin-server/conf/gremlin-server.yaml
index 97ce3c5..40f2c88 100644
--- a/gremlin-server/conf/gremlin-server.yaml
+++ b/gremlin-server/conf/gremlin-server.yaml
@@ -34,8 +34,8 @@ scriptEngines: {
       imports: [java.lang.Math],
       staticImports: [java.lang.Math.PI]}}
 serializers:
-  - { className: org.apache.tinkerpop.gremlin.driver.ser.KryoMessageSerializerV1d0 }
-  - { className: org.apache.tinkerpop.gremlin.driver.ser.KryoMessageSerializerV1d0, config: { serializeResultToString: true }}
+  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0 }
+  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }}
   - { className: org.apache.tinkerpop.gremlin.driver.ser.JsonMessageSerializerGremlinV1d0 }
   - { className: org.apache.tinkerpop.gremlin.driver.ser.JsonMessageSerializerV1d0 }
 processors:

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinAdditionPerformanceTest.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinAdditionPerformanceTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinAdditionPerformanceTest.java
index 765ad28..6bb9509 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinAdditionPerformanceTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinAdditionPerformanceTest.java
@@ -75,7 +75,7 @@ public class GremlinAdditionPerformanceTest extends AbstractGremlinServerPerform
     @BenchmarkOptions(benchmarkRounds = 20, warmupRounds = 1, concurrency = BenchmarkOptions.CONCURRENCY_AVAILABLE_CORES)
     @Test
     public void webSocketsGremlinConcurrentAlternateSerialization() throws Exception {
-        final Serializers[] mimes = new Serializers[]{Serializers.JSON, Serializers.JSON_V1D0, Serializers.KRYO_V1D0};
+        final Serializers[] mimes = new Serializers[]{Serializers.JSON, Serializers.JSON_V1D0, Serializers.GRYO_V1D0};
         final Serializers mimeType = mimes[rand.nextInt(3)];
         System.out.println(mimeType);
         final Cluster cluster = Cluster.build("localhost")

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
index d03536a..3d9e258 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
@@ -24,8 +24,8 @@ import org.apache.tinkerpop.gremlin.driver.Result;
 import org.apache.tinkerpop.gremlin.driver.ResultSet;
 import org.apache.tinkerpop.gremlin.driver.exception.ResponseException;
 import org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode;
-import org.apache.tinkerpop.gremlin.driver.ser.JsonBuilderKryoSerializer;
-import org.apache.tinkerpop.gremlin.driver.ser.KryoMessageSerializerV1d0;
+import org.apache.tinkerpop.gremlin.driver.ser.JsonBuilderGryoSerializer;
+import org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory;
 import org.apache.tinkerpop.gremlin.util.TimeUtil;
@@ -239,7 +239,7 @@ public class GremlinDriverIntegrateTest extends AbstractGremlinServerIntegration
     public void shouldSerializeToStringWhenRequested() throws Exception {
         final Map<String, Object> m = new HashMap<>();
         m.put("serializeResultToString", true);
-        final KryoMessageSerializerV1d0 serializer = new KryoMessageSerializerV1d0();
+        final GryoMessageSerializerV1d0 serializer = new GryoMessageSerializerV1d0();
         serializer.configure(m, null);
 
         final Cluster cluster = Cluster.build().serializer(serializer).create();
@@ -256,8 +256,8 @@ public class GremlinDriverIntegrateTest extends AbstractGremlinServerIntegration
     @Test
     public void shouldDeserializeWithCustomClasses() throws Exception {
         final Map<String, Object> m = new HashMap<>();
-        m.put("custom", Arrays.asList(String.format("%s;%s", JsonBuilder.class.getCanonicalName(), JsonBuilderKryoSerializer.class.getCanonicalName())));
-        final KryoMessageSerializerV1d0 serializer = new KryoMessageSerializerV1d0();
+        m.put("custom", Arrays.asList(String.format("%s;%s", JsonBuilder.class.getCanonicalName(), JsonBuilderGryoSerializer.class.getCanonicalName())));
+        final GryoMessageSerializerV1d0 serializer = new GryoMessageSerializerV1d0();
         serializer.configure(m, null);
 
         final Cluster cluster = Cluster.build().serializer(serializer).create();

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-integration.yaml
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-integration.yaml b/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-integration.yaml
index 7bb082e..124408f 100644
--- a/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-integration.yaml
+++ b/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-integration.yaml
@@ -34,8 +34,8 @@ scriptEngines: {
       imports: [java.lang.Math],
       staticImports: [java.lang.Math.PI]}}
 serializers:
-  - { className: org.apache.tinkerpop.gremlin.driver.ser.KryoMessageSerializerV1d0, config: { custom: [groovy.json.JsonBuilder;org.apache.tinkerpop.gremlin.driver.ser.JsonBuilderKryoSerializer]}}
-  - { className: org.apache.tinkerpop.gremlin.driver.ser.KryoMessageSerializerV1d0, config: { serializeResultToString: true}}
+  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { custom: [groovy.json.JsonBuilder;org.apache.tinkerpop.gremlin.driver.ser.JsonBuilderGryoSerializer]}}
+  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true}}
   - { className: org.apache.tinkerpop.gremlin.driver.ser.JsonMessageSerializerGremlinV1d0 }
   - { className: org.apache.tinkerpop.gremlin.driver.ser.JsonMessageSerializerV1d0 }
 processors:

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-performance.yaml
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-performance.yaml b/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-performance.yaml
index 6c583cb..59b38e1 100644
--- a/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-performance.yaml
+++ b/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-performance.yaml
@@ -34,7 +34,7 @@ scriptEngines: {
       imports: [java.lang.Math],
       staticImports: [java.lang.Math.PI]}}
 serializers:
-  - { className: org.apache.tinkerpop.gremlin.driver.ser.KryoMessageSerializerV1d0 }
+  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0 }
   - { className: org.apache.tinkerpop.gremlin.driver.ser.JsonMessageSerializerGremlinV1d0 }
   - { className: org.apache.tinkerpop.gremlin.driver.ser.JsonMessageSerializerV1d0 }
 processors:

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGraphProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGraphProvider.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGraphProvider.java
index 15fb629..d29b367 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGraphProvider.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGraphProvider.java
@@ -20,7 +20,7 @@ package org.apache.tinkerpop.gremlin;
 
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.io.GraphReader;
-import org.apache.tinkerpop.gremlin.structure.io.kryo.KryoReader;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader;
 import org.apache.commons.configuration.BaseConfiguration;
 import org.apache.commons.configuration.Configuration;
 
@@ -109,11 +109,11 @@ public abstract class AbstractGraphProvider implements GraphProvider {
     }
 
     protected void readIntoGraph(final Graph g, final String path) throws IOException {
-        final File workingDirectory = TestHelper.makeTestDataPath(this.getClass(), "kryo-working-directory");
+        final File workingDirectory = TestHelper.makeTestDataPath(this.getClass(), "gryo-working-directory");
         if (!workingDirectory.exists()) workingDirectory.mkdirs();
-        final GraphReader reader = KryoReader.build()
+        final GraphReader reader = GryoReader.build()
                 .workingDirectory(workingDirectory.getAbsolutePath())
-                .mapper(g.io().kryoMapper().create())
+                .mapper(g.io().gryoMapper().create())
                 .create();
         try (final InputStream stream = AbstractGremlinTest.class.getResourceAsStream(path)) {
             reader.readGraph(stream, g);

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/LoadGraphWith.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/LoadGraphWith.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/LoadGraphWith.java
index 20e6f8e..b893891 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/LoadGraphWith.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/LoadGraphWith.java
@@ -107,13 +107,13 @@ public @interface LoadGraphWith {
         public String location() {
             switch (this) {
                 case CLASSIC:
-                    return RESOURCE_PATH_PREFIX + "tinkerpop-classic.gio";
+                    return RESOURCE_PATH_PREFIX + "tinkerpop-classic.kryo";
                 case CREW:
-                    return RESOURCE_PATH_PREFIX + "tinkerpop-crew.gio";
+                    return RESOURCE_PATH_PREFIX + "tinkerpop-crew.kryo";
                 case MODERN:
-                    return RESOURCE_PATH_PREFIX + "tinkerpop-modern.gio";
+                    return RESOURCE_PATH_PREFIX + "tinkerpop-modern.kryo";
                 case GRATEFUL:
-                    return RESOURCE_PATH_PREFIX + "grateful-dead.gio";
+                    return RESOURCE_PATH_PREFIX + "grateful-dead.kryo";
             }
 
             throw new RuntimeException("No file for this GraphData type");
@@ -135,7 +135,7 @@ public @interface LoadGraphWith {
         }
     }
 
-    public static final String RESOURCE_PATH_PREFIX = "/org/apache/tinkerpop/gremlin/structure/io/kryo/";
+    public static final String RESOURCE_PATH_PREFIX = "/org/apache/tinkerpop/gremlin/structure/io/gryo/";
 
     /**
      * The name of the resource to load with full path.

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphWritePerformanceTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphWritePerformanceTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphWritePerformanceTest.java
index b490aab..8c34f41 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphWritePerformanceTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphWritePerformanceTest.java
@@ -29,7 +29,7 @@ import org.apache.tinkerpop.gremlin.LoadGraphWith;
 import org.apache.tinkerpop.gremlin.structure.io.GraphWriter;
 import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLWriter;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter;
-import org.apache.tinkerpop.gremlin.structure.io.kryo.KryoWriter;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.runners.Enclosed;
@@ -94,8 +94,8 @@ public class GraphWritePerformanceTest {
         @Test
         @LoadGraphWith(LoadGraphWith.GraphData.GRATEFUL)
         @BenchmarkOptions(benchmarkRounds = 10, warmupRounds = 0, concurrency = BenchmarkOptions.CONCURRENCY_SEQUENTIAL)
-        public void writeKryo() throws Exception {
-            final GraphWriter writer = KryoWriter.build().create();
+        public void writeGryo() throws Exception {
+            final GraphWriter writer = GryoWriter.build().create();
             final OutputStream os = new ByteArrayOutputStream();
             writer.writeGraph(os, g);
         }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
index 6b06382..a5d03a1 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
@@ -47,10 +47,10 @@ import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONReader;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONTokens;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.LegacyGraphSONReader;
-import org.apache.tinkerpop.gremlin.structure.io.kryo.KryoMapper;
-import org.apache.tinkerpop.gremlin.structure.io.kryo.KryoReader;
-import org.apache.tinkerpop.gremlin.structure.io.kryo.KryoWriter;
-import org.apache.tinkerpop.gremlin.structure.io.kryo.VertexByteArrayInputStream;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoMapper;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.VertexByteArrayInputStream;
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedFactory;
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
 import org.apache.tinkerpop.gremlin.util.StreamFactory;
@@ -304,12 +304,12 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = FEATURE_ANY_IDS)
-    public void shouldProperlySerializeCustomIdWithKryo() throws Exception {
+    public void shouldProperlySerializeCustomIdWithGryo() throws Exception {
         g.addVertex(T.id, new CustomId("vertex", UUID.fromString("AF4B5965-B176-4552-B3C1-FBBE2F52C305")));
-        final KryoMapper kryo = KryoMapper.build().addCustom(CustomId.class).create();
+        final GryoMapper gryo = GryoMapper.build().addCustom(CustomId.class).create();
 
-        final KryoWriter writer = KryoWriter.build().mapper(kryo).create();
-        final KryoReader reader = KryoReader.build().mapper(kryo).create();
+        final GryoWriter writer = GryoWriter.build().mapper(gryo).create();
+        final GryoReader reader = GryoReader.build().mapper(gryo).create();
 
         final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName());
         graphProvider.clear(configuration);
@@ -335,8 +335,8 @@ public class IoTest extends AbstractGremlinTest {
         graphProvider.clear(configuration);
         final Graph g1 = graphProvider.openTestGraph(configuration);
 
-        final KryoReader reader = g.io().kryoReader().create();
-        final KryoWriter writer = g.io().kryoWriter().create();
+        final GryoReader reader = g.io().gryoReader().create();
+        final GryoWriter writer = g.io().gryoWriter().create();
 
         GraphMigrator.migrateGraph(g, g1, reader, writer);
 
@@ -355,8 +355,8 @@ public class IoTest extends AbstractGremlinTest {
         graphProvider.clear(configuration);
         final Graph g1 = graphProvider.openTestGraph(configuration);
 
-        final KryoReader reader = g.io().kryoReader().create();
-        final KryoWriter writer = g.io().kryoWriter().create();
+        final GryoReader reader = g.io().gryoReader().create();
+        final GryoWriter writer = g.io().gryoWriter().create();
 
         GraphMigrator.migrateGraph(g, g1, reader, writer);
 
@@ -373,15 +373,15 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_NUMERIC_IDS)
     @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
-    public void shouldReadWriteModernToKryo() throws Exception {
+    public void shouldReadWriteModernToGryo() throws Exception {
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final KryoWriter writer = g.io().kryoWriter().create();
+            final GryoWriter writer = g.io().gryoWriter().create();
             writer.writeGraph(os, g);
 
             final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName());
             graphProvider.clear(configuration);
             final Graph g1 = graphProvider.openTestGraph(configuration);
-            final KryoReader reader = g.io().kryoReader().workingDirectory(File.separator + "tmp").create();
+            final GryoReader reader = g.io().gryoReader().workingDirectory(File.separator + "tmp").create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readGraph(bais, g1);
             }
@@ -400,14 +400,14 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_NUMERIC_IDS)
     @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
-    public void shouldReadWriteModernToKryoToFileWithHelpers() throws Exception {
-        final File f = TestHelper.generateTempFile(this.getClass(), name.getMethodName(), ".gio");
+    public void shouldReadWriteModernToGryoToFileWithHelpers() throws Exception {
+        final File f = TestHelper.generateTempFile(this.getClass(), name.getMethodName(), ".kryo");
         try {
-            g.io().writeKryo(f.getAbsolutePath());
+            g.io().writeGryo(f.getAbsolutePath());
 
             final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName());
             final Graph g1 = graphProvider.openTestGraph(configuration);
-            g1.io().readKryo(f.getAbsolutePath());
+            g1.io().readGryo(f.getAbsolutePath());
 
             // by making this lossy for float it will assert floats for doubles
             assertModernGraph(g1, true, false);
@@ -426,17 +426,17 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_NUMERIC_IDS)
     @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
-    public void shouldReadWriteCrewToKryo() throws Exception {
+    public void shouldReadWriteCrewToGryo() throws Exception {
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
 
-            final KryoWriter writer = g.io().kryoWriter().create();
+            final GryoWriter writer = g.io().gryoWriter().create();
             writer.writeGraph(os, g);
 
             final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName());
             graphProvider.clear(configuration);
             final Graph g1 = graphProvider.openTestGraph(configuration);
-            final KryoReader reader = KryoReader.build()
-                    .mapper(g.io().kryoMapper().create())
+            final GryoReader reader = GryoReader.build()
+                    .mapper(g.io().gryoMapper().create())
                     .workingDirectory(File.separator + "tmp").create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readGraph(bais, g1);
@@ -457,15 +457,15 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_NUMERIC_IDS)
     @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
-    public void shouldReadWriteClassicToKryo() throws Exception {
+    public void shouldReadWriteClassicToGryo() throws Exception {
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final KryoWriter writer = g.io().kryoWriter().create();
+            final GryoWriter writer = g.io().gryoWriter().create();
             writer.writeGraph(os, g);
 
             final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName());
             graphProvider.clear(configuration);
             final Graph g1 = graphProvider.openTestGraph(configuration);
-            final KryoReader reader = g.io().kryoReader().workingDirectory(File.separator + "tmp").create();
+            final GryoReader reader = g.io().gryoReader().workingDirectory(File.separator + "tmp").create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readGraph(bais, g1);
             }
@@ -579,17 +579,17 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     @FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_FLOAT_VALUES)
-    public void shouldReadWriteEdgeToKryoUsingFloatProperty() throws Exception {
+    public void shouldReadWriteEdgeToGryoUsingFloatProperty() throws Exception {
         final Vertex v1 = g.addVertex(T.label, "person");
         final Vertex v2 = g.addVertex(T.label, "person");
         final Edge e = v1.addEdge("friend", v2, "weight", 0.5f, "acl", "rw");
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final KryoWriter writer = g.io().kryoWriter().create();
+            final GryoWriter writer = g.io().gryoWriter().create();
             writer.writeEdge(os, e);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final KryoReader reader = g.io().kryoReader().workingDirectory(File.separator + "tmp").create();
+            final GryoReader reader = g.io().gryoReader().workingDirectory(File.separator + "tmp").create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
                     assertEquals(e.id(), detachedEdge.id());
@@ -615,17 +615,17 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     @FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
-    public void shouldReadWriteEdgeToKryo() throws Exception {
+    public void shouldReadWriteEdgeToGryo() throws Exception {
         final Vertex v1 = g.addVertex(T.label, "person");
         final Vertex v2 = g.addVertex(T.label, "person");
         final Edge e = v1.addEdge("friend", v2, "weight", 0.5d, "acl", "rw");
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final KryoWriter writer = g.io().kryoWriter().create();
+            final GryoWriter writer = g.io().gryoWriter().create();
             writer.writeEdge(os, e);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final KryoReader reader = g.io().kryoReader().workingDirectory(File.separator + "tmp").create();
+            final GryoReader reader = g.io().gryoReader().workingDirectory(File.separator + "tmp").create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
                     assertEquals(e.id(), detachedEdge.id());
@@ -649,17 +649,17 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     @FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
-    public void shouldReadWriteDetachedEdgeAsReferenceToKryo() throws Exception {
+    public void shouldReadWriteDetachedEdgeAsReferenceToGryo() throws Exception {
         final Vertex v1 = g.addVertex(T.label, "person");
         final Vertex v2 = g.addVertex(T.label, "person");
         final Edge e = DetachedFactory.detach(v1.addEdge("friend", v2, "weight", 0.5d, "acl", "rw"), false);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final KryoWriter writer = g.io().kryoWriter().create();
+            final GryoWriter writer = g.io().gryoWriter().create();
             writer.writeEdge(os, e);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final KryoReader reader = g.io().kryoReader().workingDirectory(File.separator + "tmp").create();
+            final GryoReader reader = g.io().gryoReader().workingDirectory(File.separator + "tmp").create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
                     assertEquals(e.id(), detachedEdge.id());
@@ -683,17 +683,17 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     @FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
-    public void shouldReadWriteDetachedEdgeToKryo() throws Exception {
+    public void shouldReadWriteDetachedEdgeToGryo() throws Exception {
         final Vertex v1 = g.addVertex(T.label, "person");
         final Vertex v2 = g.addVertex(T.label, "person");
         final Edge e = DetachedFactory.detach(v1.addEdge("friend", v2, "weight", 0.5d, "acl", "rw"), true);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final KryoWriter writer = g.io().kryoWriter().create();
+            final GryoWriter writer = g.io().gryoWriter().create();
             writer.writeEdge(os, e);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final KryoReader reader = g.io().kryoReader().workingDirectory(File.separator + "tmp").create();
+            final GryoReader reader = g.io().gryoReader().workingDirectory(File.separator + "tmp").create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
                     assertEquals(e.id(), detachedEdge.id());
@@ -895,18 +895,18 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     @FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_SERIALIZABLE_VALUES)
-    public void shouldSupportUUIDInKryo() throws Exception {
+    public void shouldSupportUUIDInGryo() throws Exception {
         final UUID id = UUID.randomUUID();
         final Vertex v1 = g.addVertex(T.label, "person");
         final Vertex v2 = g.addVertex(T.label, "person");
         final Edge e = v1.addEdge("friend", v2, "uuid", id);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final KryoWriter writer = g.io().kryoWriter().create();
+            final GryoWriter writer = g.io().gryoWriter().create();
             writer.writeEdge(os, e);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final KryoReader reader = g.io().kryoReader().workingDirectory(File.separator + "tmp").create();
+            final GryoReader reader = g.io().gryoReader().workingDirectory(File.separator + "tmp").create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
                     assertEquals(e.id(), detachedEdge.id());
@@ -933,18 +933,18 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     @FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
     @FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_FLOAT_VALUES)
-    public void shouldReadWriteVertexNoEdgesToKryoUsingFloatProperty() throws Exception {
+    public void shouldReadWriteVertexNoEdgesToGryoUsingFloatProperty() throws Exception {
         final Vertex v1 = g.addVertex("name", "marko", "acl", "rw");
 
         final Vertex v2 = g.addVertex();
         v1.addEdge("friends", v2, "weight", 0.5f);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final KryoWriter writer = g.io().kryoWriter().create();
+            final GryoWriter writer = g.io().gryoWriter().create();
             writer.writeVertex(os, v1);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final KryoReader reader = g.io().kryoReader().workingDirectory(File.separator + "tmp").create();
+            final GryoReader reader = g.io().gryoReader().workingDirectory(File.separator + "tmp").create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, detachedVertex -> {
                     assertEquals(v1.id(), detachedVertex.id());
@@ -965,17 +965,17 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     @FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
     @FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
-    public void shouldReadWriteVertexNoEdgesToKryo() throws Exception {
+    public void shouldReadWriteVertexNoEdgesToGryo() throws Exception {
         final Vertex v1 = g.addVertex("name", "marko", "acl", "rw");
         final Vertex v2 = g.addVertex();
         v1.addEdge("friends", v2, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final KryoWriter writer = g.io().kryoWriter().create();
+            final GryoWriter writer = g.io().gryoWriter().create();
             writer.writeVertex(os, v1);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final KryoReader reader = g.io().kryoReader().workingDirectory(File.separator + "tmp").create();
+            final GryoReader reader = g.io().gryoReader().workingDirectory(File.separator + "tmp").create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, detachedVertex -> {
                     assertEquals(v1.id(), detachedVertex.id());
@@ -996,18 +996,18 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     @FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
     @FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
-    public void shouldReadWriteDetachedVertexNoEdgesToKryo() throws Exception {
+    public void shouldReadWriteDetachedVertexNoEdgesToGryo() throws Exception {
         final Vertex v1 = g.addVertex("name", "marko", "acl", "rw");
         final Vertex v2 = g.addVertex();
         v1.addEdge("friends", v2, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final KryoWriter writer = g.io().kryoWriter().create();
+            final GryoWriter writer = g.io().gryoWriter().create();
             final DetachedVertex dv = DetachedFactory.detach(v1, true);
             writer.writeVertex(os, dv);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final KryoReader reader = g.io().kryoReader().workingDirectory(File.separator + "tmp").create();
+            final GryoReader reader = g.io().gryoReader().workingDirectory(File.separator + "tmp").create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, detachedVertex -> {
                     assertEquals(v1.id(), detachedVertex.id());
@@ -1028,18 +1028,18 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     @FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
     @FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
-    public void shouldReadWriteDetachedVertexAsReferenceNoEdgesToKryo() throws Exception {
+    public void shouldReadWriteDetachedVertexAsReferenceNoEdgesToGryo() throws Exception {
         final Vertex v1 = g.addVertex("name", "marko", "acl", "rw");
         final Vertex v2 = g.addVertex();
         v1.addEdge("friends", v2, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final KryoWriter writer = g.io().kryoWriter().create();
+            final GryoWriter writer = g.io().gryoWriter().create();
             final DetachedVertex dv = DetachedFactory.detach(v1, false);
             writer.writeVertex(os, dv);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final KryoReader reader = g.io().kryoReader().workingDirectory(File.separator + "tmp").create();
+            final GryoReader reader = g.io().gryoReader().workingDirectory(File.separator + "tmp").create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, detachedVertex -> {
                     assertEquals(v1.id(), detachedVertex.id());
@@ -1060,18 +1060,18 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_MULTI_PROPERTIES)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_META_PROPERTIES)
-    public void shouldReadWriteVertexMultiPropsNoEdgesToKryo() throws Exception {
+    public void shouldReadWriteVertexMultiPropsNoEdgesToGryo() throws Exception {
         final Vertex v1 = g.addVertex("name", "marko", "name", "mark", "acl", "rw");
         v1.property("propsSquared", 123, "x", "a", "y", "b");
         final Vertex v2 = g.addVertex();
         v1.addEdge("friends", v2, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final KryoWriter writer = g.io().kryoWriter().create();
+            final GryoWriter writer = g.io().gryoWriter().create();
             writer.writeVertex(os, v1);
 
             final AtomicBoolean called = new AtomicBoolean(false);
-            final KryoReader reader = g.io().kryoReader().workingDirectory(File.separator + "tmp").create();
+            final GryoReader reader = g.io().gryoReader().workingDirectory(File.separator + "tmp").create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, detachedVertex -> {
                     assertEquals(v1.id(), detachedVertex.id());
@@ -1229,13 +1229,13 @@ public class IoTest extends AbstractGremlinTest {
 
     @Test
     @LoadGraphWith(LoadGraphWith.GraphData.CLASSIC)
-    public void shouldReadWriteVerticesNoEdgesToKryoManual() throws Exception {
+    public void shouldReadWriteVerticesNoEdgesToGryoManual() throws Exception {
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final KryoWriter writer = g.io().kryoWriter().create();
+            final GryoWriter writer = g.io().gryoWriter().create();
             writer.writeVertices(os, g.V().has("age", Compare.gt, 30));
 
             final AtomicInteger called = new AtomicInteger(0);
-            final KryoReader reader = g.io().kryoReader().workingDirectory(File.separator + "tmp").create();
+            final GryoReader reader = g.io().gryoReader().workingDirectory(File.separator + "tmp").create();
 
             try (final VertexByteArrayInputStream vbais = new VertexByteArrayInputStream(new ByteArrayInputStream(os.toByteArray()))) {
                 reader.readVertex(new ByteArrayInputStream(vbais.readVertexBytes().toByteArray()),
@@ -1257,13 +1257,13 @@ public class IoTest extends AbstractGremlinTest {
 
     @Test
     @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
-    public void shouldReadWriteVerticesNoEdgesToKryo() throws Exception {
+    public void shouldReadWriteVerticesNoEdgesToGryo() throws Exception {
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final KryoWriter writer = g.io().kryoWriter().create();
+            final GryoWriter writer = g.io().gryoWriter().create();
             writer.writeVertices(os, g.V().has("age", Compare.gt, 30));
 
             final AtomicInteger called = new AtomicInteger(0);
-            final KryoReader reader = g.io().kryoReader().workingDirectory(File.separator + "tmp").create();
+            final GryoReader reader = g.io().gryoReader().workingDirectory(File.separator + "tmp").create();
 
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 final Iterator<Vertex> itty = reader.readVertices(bais, null,
@@ -1315,19 +1315,19 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     @FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
     @FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
-    public void shouldReadWriteVertexWithOUTOUTEdgesToKryo() throws Exception {
+    public void shouldReadWriteVertexWithOUTOUTEdgesToGryo() throws Exception {
         final Vertex v1 = g.addVertex("name", "marko", T.label, "person");
 
         final Vertex v2 = g.addVertex(T.label, "person");
         final Edge e = v1.addEdge("friends", v2, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final KryoWriter writer = g.io().kryoWriter().create();
+            final GryoWriter writer = g.io().gryoWriter().create();
             writer.writeVertex(os, v1, Direction.OUT);
 
             final AtomicBoolean calledVertex = new AtomicBoolean(false);
             final AtomicBoolean calledEdge = new AtomicBoolean(false);
-            final KryoReader reader = g.io().kryoReader().workingDirectory(File.separator + "tmp").create();
+            final GryoReader reader = g.io().gryoReader().workingDirectory(File.separator + "tmp").create();
 
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.OUT, detachedVertex -> {
@@ -1411,20 +1411,20 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     @FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
     @FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
-    public void shouldReadWriteVertexWithININEdgesToKryo() throws Exception {
+    public void shouldReadWriteVertexWithININEdgesToGryo() throws Exception {
         final Vertex v1 = g.addVertex("name", "marko", T.label, "person");
 
         final Vertex v2 = g.addVertex(T.label, "person");
         final Edge e = v2.addEdge("friends", v1, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final KryoWriter writer = g.io().kryoWriter().create();
+            final GryoWriter writer = g.io().gryoWriter().create();
             writer.writeVertex(os, v1, Direction.IN);
 
             final AtomicBoolean calledVertex = new AtomicBoolean(false);
             final AtomicBoolean calledEdge = new AtomicBoolean(false);
 
-            final KryoReader reader = g.io().kryoReader().workingDirectory(File.separator + "tmp").create();
+            final GryoReader reader = g.io().gryoReader().workingDirectory(File.separator + "tmp").create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.IN, detachedVertex -> {
                     assertEquals(v1.id(), detachedVertex.id());
@@ -1508,7 +1508,7 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     @FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
     @FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
-    public void shouldReadWriteVertexWithBOTHBOTHEdgesToKryo() throws Exception {
+    public void shouldReadWriteVertexWithBOTHBOTHEdgesToGryo() throws Exception {
         final Vertex v1 = g.addVertex("name", "marko", T.label, "person");
 
         final Vertex v2 = g.addVertex(T.label, "person");
@@ -1516,14 +1516,14 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e2 = v1.addEdge("friends", v2, "weight", 1.0d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final KryoWriter writer = g.io().kryoWriter().create();
+            final GryoWriter writer = g.io().gryoWriter().create();
             writer.writeVertex(os, v1, Direction.BOTH);
 
             final AtomicBoolean calledVertex = new AtomicBoolean(false);
             final AtomicBoolean calledEdge1 = new AtomicBoolean(false);
             final AtomicBoolean calledEdge2 = new AtomicBoolean(false);
 
-            final KryoReader reader = g.io().kryoReader().workingDirectory(File.separator + "tmp").create();
+            final GryoReader reader = g.io().gryoReader().workingDirectory(File.separator + "tmp").create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.BOTH, detachedVertex -> {
                             assertEquals(v1.id(), detachedVertex.id());
@@ -1699,7 +1699,7 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     @FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
     @FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
-    public void shouldReadWriteVertexWithBOTHINEdgesToKryo() throws Exception {
+    public void shouldReadWriteVertexWithBOTHINEdgesToGryo() throws Exception {
         final Vertex v1 = g.addVertex("name", "marko", T.label, "person");
 
         final Vertex v2 = g.addVertex(T.label, "person");
@@ -1707,13 +1707,13 @@ public class IoTest extends AbstractGremlinTest {
         v1.addEdge("friends", v2, "weight", 1.0d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final KryoWriter writer = g.io().kryoWriter().create();
+            final GryoWriter writer = g.io().gryoWriter().create();
             writer.writeVertex(os, v1, Direction.BOTH);
 
             final AtomicBoolean vertexCalled = new AtomicBoolean(false);
             final AtomicBoolean edge1Called = new AtomicBoolean(false);
 
-            final KryoReader reader = g.io().kryoReader().workingDirectory(File.separator + "tmp").create();
+            final GryoReader reader = g.io().gryoReader().workingDirectory(File.separator + "tmp").create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.IN, detachedVertex -> {
                             assertEquals(v1.id(), detachedVertex.id());
@@ -1805,7 +1805,7 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     @FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
     @FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
-    public void shouldReadWriteVertexWithBOTHOUTEdgesToKryo() throws Exception {
+    public void shouldReadWriteVertexWithBOTHOUTEdgesToGryo() throws Exception {
         final Vertex v1 = g.addVertex("name", "marko", T.label, "person");
 
         final Vertex v2 = g.addVertex(T.label, "person");
@@ -1813,13 +1813,13 @@ public class IoTest extends AbstractGremlinTest {
         final Edge e2 = v1.addEdge("friends", v2, "weight", 1.0d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final KryoWriter writer = g.io().kryoWriter().create();
+            final GryoWriter writer = g.io().gryoWriter().create();
             writer.writeVertex(os, v1, Direction.BOTH);
 
             final AtomicBoolean vertexCalled = new AtomicBoolean(false);
             final AtomicBoolean edgeCalled = new AtomicBoolean(false);
 
-            final KryoReader reader = g.io().kryoReader().workingDirectory(File.separator + "tmp").create();
+            final GryoReader reader = g.io().gryoReader().workingDirectory(File.separator + "tmp").create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.OUT, detachedVertex -> {
                             assertEquals(v1.id(), detachedVertex.id());
@@ -1911,16 +1911,16 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     @FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
     @FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
-    public void shouldReadWriteVertexWithOUTBOTHEdgesToKryo() throws Exception {
+    public void shouldReadWriteVertexWithOUTBOTHEdgesToGryo() throws Exception {
         final Vertex v1 = g.addVertex("name", "marko");
         final Vertex v2 = g.addVertex();
         v1.addEdge("friends", v2, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final KryoWriter writer = g.io().kryoWriter().create();
+            final GryoWriter writer = g.io().gryoWriter().create();
             writer.writeVertex(os, v1, Direction.OUT);
 
-            final KryoReader reader = g.io().kryoReader().workingDirectory(File.separator + "tmp").create();
+            final GryoReader reader = g.io().gryoReader().workingDirectory(File.separator + "tmp").create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais,
                         Direction.BOTH,
@@ -1935,16 +1935,16 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     @FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
     @FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
-    public void shouldReadWriteVertexWithINBOTHEdgesToKryo() throws Exception {
+    public void shouldReadWriteVertexWithINBOTHEdgesToGryo() throws Exception {
         final Vertex v1 = g.addVertex("name", "marko");
         final Vertex v2 = g.addVertex();
         v2.addEdge("friends", v1, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final KryoWriter writer = g.io().kryoWriter().create();
+            final GryoWriter writer = g.io().gryoWriter().create();
             writer.writeVertex(os, v1, Direction.IN);
 
-            final KryoReader reader = g.io().kryoReader().workingDirectory(File.separator + "tmp").create();
+            final GryoReader reader = g.io().gryoReader().workingDirectory(File.separator + "tmp").create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais,
                         Direction.BOTH,
@@ -1959,16 +1959,16 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     @FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
     @FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
-    public void shouldReadWriteVertexWithINOUTEdgesToKryo() throws Exception {
+    public void shouldReadWriteVertexWithINOUTEdgesToGryo() throws Exception {
         final Vertex v1 = g.addVertex("name", "marko");
         final Vertex v2 = g.addVertex();
         v2.addEdge("friends", v1, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final KryoWriter writer = g.io().kryoWriter().create();
+            final GryoWriter writer = g.io().gryoWriter().create();
             writer.writeVertex(os, v1, Direction.IN);
 
-            final KryoReader reader = g.io().kryoReader().workingDirectory(File.separator + "tmp").create();
+            final GryoReader reader = g.io().gryoReader().workingDirectory(File.separator + "tmp").create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais,
                         Direction.OUT,
@@ -1983,16 +1983,16 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     @FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
     @FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_DOUBLE_VALUES)
-    public void shouldReadWriteVertexWithOUTINEdgesToKryo() throws Exception {
+    public void shouldReadWriteVertexWithOUTINEdgesToGryo() throws Exception {
         final Vertex v1 = g.addVertex("name", "marko");
         final Vertex v2 = g.addVertex();
         v1.addEdge("friends", v2, "weight", 0.5d);
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final KryoWriter writer = g.io().kryoWriter().create();
+            final GryoWriter writer = g.io().gryoWriter().create();
             writer.writeVertex(os, v1, Direction.IN);
 
-            final KryoReader reader = g.io().kryoReader().workingDirectory(File.separator + "tmp").create();
+            final GryoReader reader = g.io().gryoReader().workingDirectory(File.separator + "tmp").create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais,
                         Direction.OUT,
@@ -2527,7 +2527,7 @@ public class IoTest extends AbstractGremlinTest {
         private UUID elementId;
 
         private CustomId() {
-            // required no-arg for kryo serialization
+            // required no-arg for gryo serialization
         }
 
         public CustomId(final String cluster, final UUID elementId) {


[5/8] incubator-tinkerpop git commit: Renamed Gremlin Kryo to simply Gryo.

Posted by ok...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/KryoReader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/KryoReader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/KryoReader.java
deleted file mode 100644
index 1d6e108..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/KryoReader.java
+++ /dev/null
@@ -1,400 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.structure.io.kryo;
-
-import com.esotericsoftware.kryo.Kryo;
-import com.esotericsoftware.kryo.io.Input;
-import com.esotericsoftware.kryo.io.Output;
-import org.apache.tinkerpop.gremlin.process.T;
-import org.apache.tinkerpop.gremlin.structure.*;
-import org.apache.tinkerpop.gremlin.structure.io.GraphReader;
-import org.apache.tinkerpop.gremlin.structure.util.batch.BatchGraph;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
-
-import java.io.*;
-import java.util.*;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.function.Function;
-
-/**
- * The {@link GraphReader} for the Gremlin Structure serialization format based on Kryo.  The format is meant to be
- * non-lossy in terms of Gremlin Structure to Gremlin Structure migrations (assuming both structure implementations
- * support the same graph features).
- * <br/>
- * This implementation is not thread-safe.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class KryoReader implements GraphReader {
-    private final Kryo kryo;
-    private final KryoMapper.HeaderReader headerReader;
-
-    private final long batchSize;
-    private final String vertexIdKey;
-    private final String edgeIdKey;
-
-    private final File tempFile;
-
-    final AtomicLong counter = new AtomicLong(0);
-
-    private KryoReader(final File tempFile, final long batchSize,
-                       final String vertexIdKey, final String edgeIdKey,
-                       final KryoMapper kryoMapper) {
-        this.kryo = kryoMapper.createMapper();
-        this.headerReader = kryoMapper.getHeaderReader();
-        this.vertexIdKey = vertexIdKey;
-        this.edgeIdKey = edgeIdKey;
-        this.tempFile = tempFile;
-        this.batchSize = batchSize;
-    }
-
-    @Override
-    public Iterator<Vertex> readVertices(final InputStream inputStream, final Direction direction,
-                                         final Function<DetachedVertex, Vertex> vertexMaker,
-                                         final Function<DetachedEdge, Edge> edgeMaker) throws IOException {
-        final Input input = new Input(inputStream);
-        return new Iterator<Vertex>() {
-            @Override
-            public boolean hasNext() {
-                return !input.eof();
-            }
-
-            @Override
-            public Vertex next() {
-                try {
-                    final Vertex v = readVertex(direction, vertexMaker, edgeMaker, input);
-
-                    // read the vertex terminator
-                    kryo.readClassAndObject(input);
-
-                    return v;
-                } catch (Exception ex) {
-                    throw new RuntimeException(ex);
-                }
-            }
-        };
-    }
-
-    @Override
-    public Edge readEdge(final InputStream inputStream, final Function<DetachedEdge, Edge> edgeMaker) throws IOException {
-        final Input input = new Input(inputStream);
-        this.headerReader.read(kryo, input);
-        final Object o = kryo.readClassAndObject(input);
-        return edgeMaker.apply((DetachedEdge) o);
-    }
-
-    @Override
-    public Vertex readVertex(final InputStream inputStream, final Function<DetachedVertex, Vertex> vertexMaker) throws IOException {
-        return readVertex(inputStream, null, vertexMaker, null);
-    }
-
-    @Override
-    public Vertex readVertex(final InputStream inputStream, final Direction direction, Function<DetachedVertex, Vertex> vertexMaker, final Function<DetachedEdge, Edge> edgeMaker) throws IOException {
-        final Input input = new Input(inputStream);
-        return readVertex(direction, vertexMaker, edgeMaker, input);
-    }
-
-    @Override
-    public void readGraph(final InputStream inputStream, final Graph graphToWriteTo) throws IOException {
-        this.counter.set(0);
-        final Input input = new Input(inputStream);
-        this.headerReader.read(kryo, input);
-
-        final BatchGraph graph;
-        try {
-            // will throw an exception if not constructed properly
-            graph = BatchGraph.build(graphToWriteTo)
-                    .vertexIdKey(vertexIdKey)
-                    .edgeIdKey(edgeIdKey)
-                    .bufferSize(batchSize).create();
-        } catch (Exception ex) {
-            throw new IOException("Could not instantiate BatchGraph wrapper", ex);
-        }
-
-        try (final Output output = new Output(new FileOutputStream(tempFile))) {
-            final boolean supportedMemory = input.readBoolean();
-            if (supportedMemory) {
-                // if the graph that serialized the data supported sideEffects then the sideEffects needs to be read
-                // to advance the reader forward.  if the graph being read into doesn't support the sideEffects
-                // then we just setting the data to sideEffects.
-                final Map<String, Object> memMap = (Map<String, Object>) kryo.readObject(input, HashMap.class);
-                if (graphToWriteTo.features().graph().variables().supportsVariables()) {
-                    final Graph.Variables variables = graphToWriteTo.variables();
-                    memMap.forEach(variables::set);
-                }
-            }
-
-            final boolean hasSomeVertices = input.readBoolean();
-            if (hasSomeVertices) {
-                final List<Object> vertexArgs = new ArrayList<>();
-                while (!input.eof()) {
-                    final DetachedVertex current = (DetachedVertex) kryo.readClassAndObject(input);
-                    appendToArgList(vertexArgs, T.id, current.id());
-                    appendToArgList(vertexArgs, T.label, current.label());
-
-                    final Vertex v = graph.addVertex(vertexArgs.toArray());
-                    vertexArgs.clear();
-                    current.iterators().propertyIterator().forEachRemaining(p -> createVertexProperty(graphToWriteTo, v, p, false));
-
-                    // the gio file should have been written with a direction specified
-                    final boolean hasDirectionSpecified = input.readBoolean();
-                    final Direction directionInStream = kryo.readObject(input, Direction.class);
-                    final Direction directionOfEdgeBatch = kryo.readObject(input, Direction.class);
-
-                    // graph serialization requires that a direction be specified in the stream and that the
-                    // direction of the edges be OUT
-                    if (!hasDirectionSpecified || directionInStream != Direction.OUT || directionOfEdgeBatch != Direction.OUT)
-                        throw new IllegalStateException(String.format("Stream must specify edge direction and that direction must be %s", Direction.OUT));
-
-                    // if there are edges then read them to end and write to temp, otherwise read what should be
-                    // the vertex terminator
-                    if (!input.readBoolean())
-                        kryo.readClassAndObject(input);
-                    else
-                        readToEndOfEdgesAndWriteToTemp(input, output);
-                }
-            }
-        } catch (Exception ex) {
-            throw new IOException(ex);
-        }
-        // done writing to temp
-
-        // start reading in the edges now from the temp file
-        try (final Input edgeInput = new Input(new FileInputStream(tempFile))) {
-            readFromTempEdges(edgeInput, graph);
-            graph.tx().commit();
-        } catch (Exception ex) {
-            ex.printStackTrace();
-            throw new IOException(ex);
-        } finally {
-            deleteTempFileSilently();
-        }
-    }
-
-    private static void createVertexProperty(final Graph graphToWriteTo, final Vertex v, final VertexProperty<Object> p, final boolean hidden) {
-        final List<Object> propertyArgs = new ArrayList<>();
-        if (graphToWriteTo.features().vertex().properties().supportsUserSuppliedIds())
-            appendToArgList(propertyArgs, T.id, p.id());
-        p.iterators().propertyIterator().forEachRemaining(it -> appendToArgList(propertyArgs, it.key(), it.value()));
-        v.property(p.key(), p.value(), propertyArgs.toArray());
-    }
-
-    private static void appendToArgList(final List<Object> propertyArgs, final Object key, final Object val) {
-        propertyArgs.add(key);
-        propertyArgs.add(val);
-    }
-
-    private Vertex readVertex(final Direction directionRequested, final Function<DetachedVertex, Vertex> vertexMaker,
-                              final Function<DetachedEdge, Edge> edgeMaker, final Input input) throws IOException {
-        if (null != directionRequested && null == edgeMaker)
-            throw new IllegalArgumentException("If a directionRequested is specified then an edgeAdder function should also be specified");
-
-        this.headerReader.read(kryo, input);
-
-        final DetachedVertex detachedVertex = (DetachedVertex) kryo.readClassAndObject(input);
-        final Vertex v = vertexMaker.apply(detachedVertex);
-
-        final boolean streamContainsEdgesInSomeDirection = input.readBoolean();
-        if (!streamContainsEdgesInSomeDirection && directionRequested != null)
-            throw new IllegalStateException(String.format("The direction %s was requested but no attempt was made to serialize edges into this stream", directionRequested));
-
-        // if there are edges in the stream and the direction is not present then the rest of the stream is
-        // simply ignored
-        if (directionRequested != null) {
-            final Direction directionsInStream = kryo.readObject(input, Direction.class);
-            if (directionsInStream != Direction.BOTH && directionsInStream != directionRequested)
-                throw new IllegalStateException(String.format("Stream contains %s edges, but requesting %s", directionsInStream, directionRequested));
-
-            final Direction firstDirection = kryo.readObject(input, Direction.class);
-            if (firstDirection == Direction.OUT && (directionRequested == Direction.BOTH || directionRequested == Direction.OUT))
-                readEdges(input, edgeMaker);
-            else {
-                // requested direction in, but BOTH must be serialized so skip this.  the illegalstateexception
-                // prior to this IF should  have caught a problem where IN is not supported at all
-                if (firstDirection == Direction.OUT && directionRequested == Direction.IN)
-                    skipEdges(input);
-            }
-
-            if (directionRequested == Direction.BOTH || directionRequested == Direction.IN) {
-                // if the first direction was OUT then it was either read or skipped.  in that case, the marker
-                // of the stream is currently ready to read the IN direction. otherwise it's in the perfect place
-                // to start reading edges
-                if (firstDirection == Direction.OUT)
-                    kryo.readObject(input, Direction.class);
-
-                readEdges(input, edgeMaker);
-            }
-        }
-
-        return v;
-    }
-
-    private void readEdges(final Input input, final Function<DetachedEdge, Edge> edgeMaker) {
-        if (input.readBoolean()) {
-            Object next = kryo.readClassAndObject(input);
-            while (!next.equals(EdgeTerminator.INSTANCE)) {
-                final DetachedEdge detachedEdge = (DetachedEdge) next;
-                edgeMaker.apply(detachedEdge);
-                next = kryo.readClassAndObject(input);
-            }
-        }
-    }
-
-    private void skipEdges(final Input input) {
-        if (input.readBoolean()) {
-            Object next = kryo.readClassAndObject(input);
-            while (!next.equals(EdgeTerminator.INSTANCE)) {
-                // next edge to skip or the terminator
-                next = kryo.readClassAndObject(input);
-            }
-        }
-    }
-
-    /**
-     * Reads through the all the edges for a vertex and writes the edges to a temp file which will be read later.
-     */
-    private void readToEndOfEdgesAndWriteToTemp(final Input input, final Output output) throws IOException {
-        Object next = kryo.readClassAndObject(input);
-        while (!next.equals(EdgeTerminator.INSTANCE)) {
-            kryo.writeClassAndObject(output, next);
-
-            // next edge or terminator
-            next = kryo.readClassAndObject(input);
-        }
-
-        // this should be the vertex terminator
-        kryo.readClassAndObject(input);
-
-        kryo.writeClassAndObject(output, EdgeTerminator.INSTANCE);
-        kryo.writeClassAndObject(output, VertexTerminator.INSTANCE);
-    }
-
-
-    /**
-     * Read the edges from the temp file and load them to the graph.
-     */
-    private void readFromTempEdges(final Input input, final Graph graphToWriteTo) {
-        final List<Object> edgeArgs = new ArrayList<>();
-        while (!input.eof()) {
-            // in this case the outId is the id assigned by the graph
-            Object next = kryo.readClassAndObject(input);
-            while (!next.equals(EdgeTerminator.INSTANCE)) {
-                final DetachedEdge detachedEdge = (DetachedEdge) next;
-                final Vertex vOut = graphToWriteTo.iterators().vertexIterator(detachedEdge.iterators().vertexIterator(Direction.OUT).next().id()).next();
-                final Vertex inV = graphToWriteTo.iterators().vertexIterator(detachedEdge.iterators().vertexIterator(Direction.IN).next().id()).next();
-
-                detachedEdge.iterators().propertyIterator().forEachRemaining(p -> edgeArgs.addAll(Arrays.asList(p.key(), p.value())));
-
-                appendToArgList(edgeArgs, T.id, detachedEdge.id());
-
-                vOut.addEdge(detachedEdge.label(), inV, edgeArgs.toArray());
-
-                edgeArgs.clear();
-                next = kryo.readClassAndObject(input);
-            }
-
-            // vertex terminator
-            kryo.readClassAndObject(input);
-        }
-    }
-
-    @SuppressWarnings("ResultOfMethodCallIgnored")
-    private void deleteTempFileSilently() {
-        try {
-            tempFile.delete();
-        } catch (Exception ignored) {
-        }
-    }
-
-    public static Builder build() {
-        return new Builder();
-    }
-
-    public static class Builder {
-        private File tempFile;
-        private long batchSize = BatchGraph.DEFAULT_BUFFER_SIZE;
-        private String vertexIdKey = T.id.getAccessor();
-        private String edgeIdKey = T.id.getAccessor();
-
-        /**
-         * Always use the most recent kryo version by default
-         */
-        private KryoMapper kryoMapper = KryoMapper.build().create();
-
-        private Builder() {
-            this.tempFile = new File(UUID.randomUUID() + ".tmp");
-        }
-
-        /**
-         * Set the size between commits when reading into the {@link Graph} instance.  This value defaults to
-         * {@link BatchGraph#DEFAULT_BUFFER_SIZE}.
-         */
-        public Builder batchSize(final long batchSize) {
-            this.batchSize = batchSize;
-            return this;
-        }
-
-        /**
-         * Supply a mapper {@link KryoMapper} instance to use as the serializer for the {@code KryoWriter}.
-         */
-        public Builder mapper(final KryoMapper kryoMapper) {
-            this.kryoMapper = kryoMapper;
-            return this;
-        }
-
-        /**
-         * The name of the key to supply to
-         * {@link org.apache.tinkerpop.gremlin.structure.util.batch.BatchGraph.Builder#vertexIdKey} when reading data into
-         * the {@link Graph}.
-         */
-        public Builder vertexIdKey(final String vertexIdKey) {
-            this.vertexIdKey = vertexIdKey;
-            return this;
-        }
-
-        /**
-         * The name of the key to supply to
-         * {@link org.apache.tinkerpop.gremlin.structure.util.batch.BatchGraph.Builder#edgeIdKey} when reading data into
-         * the {@link Graph}.
-         */
-        public Builder edgeIdKey(final String edgeIdKey) {
-            this.edgeIdKey = edgeIdKey;
-            return this;
-        }
-
-        /**
-         * The reader requires a working directory to write temp files to.  If this value is not set, it will write
-         * the temp file to the local directory.
-         */
-        public Builder workingDirectory(final String workingDirectory) {
-            final File f = new File(workingDirectory);
-            if (!f.exists() || !f.isDirectory())
-                throw new IllegalArgumentException(String.format("%s is not a directory or does not exist", workingDirectory));
-
-            tempFile = new File(workingDirectory + File.separator + UUID.randomUUID() + ".tmp");
-            return this;
-        }
-
-        public KryoReader create() {
-            return new KryoReader(tempFile, batchSize, this.vertexIdKey, this.edgeIdKey, this.kryoMapper);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/KryoWriter.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/KryoWriter.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/KryoWriter.java
deleted file mode 100644
index 7be3e4d..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/KryoWriter.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.structure.io.kryo;
-
-import com.esotericsoftware.kryo.Kryo;
-import com.esotericsoftware.kryo.io.Output;
-import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.Element;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.structure.io.GraphWriter;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedFactory;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.nio.ByteBuffer;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.UUID;
-
-/**
- * The {@link GraphWriter} for the Gremlin Structure serialization format based on Kryo.  The format is meant to be
- * non-lossy in terms of Gremlin Structure to Gremlin Structure migrations (assuming both structure implementations
- * support the same graph features).
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class KryoWriter implements GraphWriter {
-    private Kryo kryo;
-    private final KryoMapper.HeaderWriter headerWriter;
-    private static final UUID delimiter = UUID.fromString("2DEE3ABF-9963-4546-A578-C1C48690D7F7");
-    public static final byte[] DELIMITER = new byte[16];
-
-    static {
-        final ByteBuffer bb = ByteBuffer.wrap(DELIMITER);
-        bb.putLong(delimiter.getMostSignificantBits());
-        bb.putLong(delimiter.getLeastSignificantBits());
-    }
-
-    private KryoWriter(final KryoMapper kryoMapper) {
-        this.kryo = kryoMapper.createMapper();
-        this.headerWriter = kryoMapper.getHeaderWriter();
-    }
-
-    @Override
-    public void writeGraph(final OutputStream outputStream, final Graph g) throws IOException {
-        final Output output = new Output(outputStream);
-        this.headerWriter.write(kryo, output);
-
-        final boolean supportsGraphMemory = g.features().graph().variables().supportsVariables();
-        output.writeBoolean(supportsGraphMemory);
-        if (supportsGraphMemory)
-            kryo.writeObject(output, new HashMap(g.variables().asMap()));
-
-        final Iterator<Vertex> vertices = g.iterators().vertexIterator();
-        final boolean hasSomeVertices = vertices.hasNext();
-        output.writeBoolean(hasSomeVertices);
-        while (vertices.hasNext()) {
-            final Vertex v = vertices.next();
-            writeVertexToOutput(output, v, Direction.OUT);
-        }
-
-        output.flush();
-    }
-
-    @Override
-    public void writeVertex(final OutputStream outputStream, final Vertex v, final Direction direction) throws IOException {
-        final Output output = new Output(outputStream);
-        this.headerWriter.write(kryo, output);
-        writeVertexToOutput(output, v, direction);
-        output.flush();
-    }
-
-    @Override
-    public void writeVertex(final OutputStream outputStream, final Vertex v) throws IOException {
-        final Output output = new Output(outputStream);
-        this.headerWriter.write(kryo, output);
-        writeVertexWithNoEdgesToOutput(output, v);
-        output.flush();
-    }
-
-    @Override
-    public void writeEdge(final OutputStream outputStream, final Edge e) throws IOException {
-        final Output output = new Output(outputStream);
-        this.headerWriter.write(kryo, output);
-        kryo.writeClassAndObject(output, DetachedFactory.detach(e, true));
-        output.flush();
-    }
-
-    private void writeEdgeToOutput(final Output output, final Edge e) {
-        this.writeElement(output, e, null);
-    }
-
-    private void writeVertexWithNoEdgesToOutput(final Output output, final Vertex v) {
-        writeElement(output, v, null);
-    }
-
-    private void writeVertexToOutput(final Output output, final Vertex v, final Direction direction) {
-        this.writeElement(output, v, direction);
-    }
-
-    private void writeElement(final Output output, final Element e, final Direction direction) {
-        kryo.writeClassAndObject(output, e);
-
-        if (e instanceof Vertex) {
-            output.writeBoolean(direction != null);
-            if (direction != null) {
-                final Vertex v = (Vertex) e;
-                kryo.writeObject(output, direction);
-                if (direction == Direction.BOTH || direction == Direction.OUT)
-                    writeDirectionalEdges(output, Direction.OUT, v.iterators().edgeIterator(Direction.OUT));
-
-                if (direction == Direction.BOTH || direction == Direction.IN)
-                    writeDirectionalEdges(output, Direction.IN, v.iterators().edgeIterator(Direction.IN));
-            }
-
-            kryo.writeClassAndObject(output, VertexTerminator.INSTANCE);
-        }
-    }
-
-    private void writeDirectionalEdges(final Output output, final Direction d, final Iterator<Edge> vertexEdges) {
-        final boolean hasEdges = vertexEdges.hasNext();
-        kryo.writeObject(output, d);
-        output.writeBoolean(hasEdges);
-
-        while (vertexEdges.hasNext()) {
-            final Edge edgeToWrite = vertexEdges.next();
-            writeEdgeToOutput(output, edgeToWrite);
-        }
-
-        if (hasEdges)
-            kryo.writeClassAndObject(output, EdgeTerminator.INSTANCE);
-    }
-
-    public static Builder build() {
-        return new Builder();
-    }
-
-    public static class Builder {
-        /**
-         * Always creates the most current version available.
-         */
-        private KryoMapper kryoMapper = KryoMapper.build().create();
-
-        private Builder() {
-        }
-
-        /**
-         * Supply a mapper {@link KryoMapper} instance to use as the serializer for the {@code KryoWriter}.
-         */
-        public Builder mapper(final KryoMapper kryoMapper) {
-            this.kryoMapper = kryoMapper;
-            return this;
-        }
-
-        /**
-         * Create the {@code KryoWriter}.
-         */
-        public KryoWriter create() {
-            return new KryoWriter(this.kryoMapper);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/URISerializer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/URISerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/URISerializer.java
deleted file mode 100644
index 67b19d2..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/URISerializer.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.structure.io.kryo;
-
-import com.esotericsoftware.kryo.Kryo;
-import com.esotericsoftware.kryo.Serializer;
-import com.esotericsoftware.kryo.io.Input;
-import com.esotericsoftware.kryo.io.Output;
-
-import java.net.URI;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-class URISerializer extends Serializer<URI> {
-
-    public URISerializer() {
-        setImmutable(true);
-    }
-
-    @Override
-    public void write(final Kryo kryo, final Output output, final URI uri) {
-        output.writeString(uri.toString());
-    }
-
-    @Override
-    public URI read(final Kryo kryo, final Input input, final Class<URI> uriClass) {
-        return URI.create(input.readString());
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/UUIDSerializer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/UUIDSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/UUIDSerializer.java
deleted file mode 100644
index 8e5d901..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/UUIDSerializer.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.structure.io.kryo;
-
-import com.esotericsoftware.kryo.Kryo;
-import com.esotericsoftware.kryo.Serializer;
-import com.esotericsoftware.kryo.io.Input;
-import com.esotericsoftware.kryo.io.Output;
-
-import java.util.UUID;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-class UUIDSerializer extends Serializer<UUID> {
-    public UUIDSerializer() {
-        setImmutable(true);
-    }
-
-    @Override
-    public void write(final Kryo kryo, final Output output, final UUID uuid) {
-        output.writeLong(uuid.getMostSignificantBits());
-        output.writeLong(uuid.getLeastSignificantBits());
-    }
-
-    @Override
-    public UUID read(final Kryo kryo, final Input input, final Class<UUID> uuidClass) {
-        return new UUID(input.readLong(), input.readLong());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/VertexByteArrayInputStream.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/VertexByteArrayInputStream.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/VertexByteArrayInputStream.java
deleted file mode 100644
index 0fe3d2c..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/VertexByteArrayInputStream.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.structure.io.kryo;
-
-import java.io.ByteArrayOutputStream;
-import java.io.FilterInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.ByteBuffer;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * An {@link InputStream} implementation that can independently process a Gremlin Kryo file written with
- * {@link KryoWriter#writeVertices(java.io.OutputStream, org.apache.tinkerpop.gremlin.process.Traversal)}.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class VertexByteArrayInputStream extends FilterInputStream {
-
-    private static final byte[] vertexTerminatorClass = new byte[]{15, 1, 1, 9};
-    private static final byte[] pattern = ByteBuffer.allocate(vertexTerminatorClass.length + 8).put(vertexTerminatorClass).putLong(4185403236219066774L).array();
-
-    public VertexByteArrayInputStream(final InputStream inputStream) {
-        super(inputStream);
-    }
-
-    /**
-     * Read the bytes of the next {@link org.apache.tinkerpop.gremlin.structure.Vertex} in the stream. The returned
-     * stream can then be passed to {@link KryoReader#readVertex(java.io.InputStream, java.util.function.Function)}.
-     */
-    public ByteArrayOutputStream readVertexBytes() throws IOException {
-        final ByteArrayOutputStream stream = new ByteArrayOutputStream();
-        final LinkedList<Byte> buffer = new LinkedList<>();
-
-        int current = read();
-        while (current > -1 && (buffer.size() < 12 || !isMatch(buffer))) {
-            stream.write(current);
-
-            current = read();
-            if (buffer.size() > 11)
-                buffer.removeFirst();
-
-            buffer.addLast((byte) current);
-        }
-
-        return stream;
-    }
-
-    private static boolean isMatch(final List<Byte> input) {
-        for (int i = 0; i < pattern.length; i++) {
-            if (pattern[i] != input.get(i)) {
-                return false;
-            }
-        }
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/VertexTerminator.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/VertexTerminator.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/VertexTerminator.java
deleted file mode 100644
index aee1fa9..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/VertexTerminator.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.structure.io.kryo;
-
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-
-/**
- * Represents the end of a vertex in a serialization stream.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-class VertexTerminator {
-    public static final VertexTerminator INSTANCE = new VertexTerminator();
-
-    public final byte[] terminal;
-
-    private VertexTerminator() {
-        terminal = ByteBuffer.allocate(8).putLong(4185403236219066774L).array();
-    }
-
-    @Override
-    public boolean equals(final Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
-        final VertexTerminator that = (VertexTerminator) o;
-
-        return terminal == that.terminal;
-
-    }
-
-    @Override
-    public int hashCode() {
-        return Arrays.hashCode(terminal);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
index cd523ce..ae96e6b 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
@@ -185,7 +185,7 @@ public class Cluster {
     public static class Builder {
         private List<InetAddress> addresses = new ArrayList<>();
         private int port = 8182;
-        private MessageSerializer serializer = Serializers.KRYO_V1D0.simpleInstance();
+        private MessageSerializer serializer = Serializers.GRYO_V1D0.simpleInstance();
         private int nioPoolSize = Runtime.getRuntime().availableProcessors();
         private int workerPoolSize = Runtime.getRuntime().availableProcessors() * 2;
         private int minConnectionPoolSize = ConnectionPool.MIN_POOL_SIZE;

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java
new file mode 100644
index 0000000..06e110c
--- /dev/null
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java
@@ -0,0 +1,307 @@
+/*
+ * 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.driver.ser;
+
+import com.esotericsoftware.kryo.Kryo;
+import com.esotericsoftware.kryo.Serializer;
+import com.esotericsoftware.kryo.io.Input;
+import com.esotericsoftware.kryo.io.Output;
+import org.apache.tinkerpop.gremlin.driver.MessageSerializer;
+import org.apache.tinkerpop.gremlin.driver.message.RequestMessage;
+import org.apache.tinkerpop.gremlin.driver.message.ResponseMessage;
+import org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoMapper;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.ByteBufAllocator;
+import io.netty.util.ReferenceCountUtil;
+import org.javatuples.Pair;
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.UUID;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class GryoMessageSerializerV1d0 implements MessageSerializer {
+    private GryoMapper gryoMapper;
+    private ThreadLocal<Kryo> kryoThreadLocal = new ThreadLocal<Kryo>() {
+        @Override
+        protected Kryo initialValue() {
+            return gryoMapper.createMapper();
+        }
+    };
+
+    private static final Charset UTF8 = Charset.forName("UTF-8");
+
+    private static final String MIME_TYPE = SerTokens.MIME_GRYO_V1D0;
+    private static final String MIME_TYPE_STRINGD = SerTokens.MIME_GRYO_V1D0 + "-stringd";
+
+    private static final String TOKEN_EXTENDED_VERSION = "extendedVersion";
+    private static final String TOKEN_CUSTOM = "custom";
+    private static final String TOKEN_SERIALIZE_RESULT_TO_STRING = "serializeResultToString";
+    private static final String TOKEN_USE_MAPPER_FROM_GRAPH = "useMapperFromGraph";
+
+    private boolean serializeToString;
+
+    /**
+     * Creates an instance with a standard {@link org.apache.tinkerpop.gremlin.structure.io.gryo.GryoMapper} instance. Note that this instance
+     * will be overriden by {@link #configure} is called.
+     */
+    public GryoMessageSerializerV1d0() {
+        gryoMapper = GryoMapper.build(GryoMapper.Version.V_1_0_0).create();
+    }
+
+    /**
+     * Creates an instance with a provided mapper configured {@link org.apache.tinkerpop.gremlin.structure.io.gryo.GryoMapper} instance. Note that this instance
+     * will be overriden by {@link #configure} is called.
+     */
+    public GryoMessageSerializerV1d0(final GryoMapper kryo) {
+        this.gryoMapper = kryo;
+    }
+
+    @Override
+    public void configure(final Map<String, Object> config, final Map<String, Graph> graphs) {
+        final byte extendedVersion;
+        try {
+            extendedVersion = Byte.parseByte(config.getOrDefault(TOKEN_EXTENDED_VERSION, GryoMapper.DEFAULT_EXTENDED_VERSION).toString());
+        } catch (Exception ex) {
+            throw new IllegalStateException(String.format("Invalid configuration value of [%s] for [%s] setting on %s serialization configuration",
+                    config.getOrDefault(TOKEN_EXTENDED_VERSION, ""), TOKEN_EXTENDED_VERSION, this.getClass().getName()), ex);
+        }
+
+        final GryoMapper.Builder initialBuilder;
+        final Object graphToUseForMapper = config.get(TOKEN_USE_MAPPER_FROM_GRAPH);
+        if (graphToUseForMapper != null) {
+            if (null == graphs) throw new IllegalStateException(String.format(
+                    "No graphs have been provided to the serializer and therefore %s is not a valid configuration", TOKEN_USE_MAPPER_FROM_GRAPH));
+
+            final Graph g = graphs.get(graphToUseForMapper.toString());
+            if (null == g) throw new IllegalStateException(String.format(
+                    "There is no graph named [%s] configured to be used in the %s setting",
+                    graphToUseForMapper, TOKEN_USE_MAPPER_FROM_GRAPH));
+
+            // a graph was found so use the mapper it constructs.  this allows gryo to be auto-configured with any
+            // custom classes that the implementation allows for
+            initialBuilder = g.io().gryoMapper();
+        } else {
+            // no graph was supplied so just use the default - this will likely be the case when using a graph
+            // with no custom classes or a situation where the user needs complete control like when using two
+            // distinct implementations each with their own custom classes.
+            initialBuilder = GryoMapper.build(GryoMapper.Version.V_1_0_0);
+        }
+
+        final GryoMapper.Builder builder = initialBuilder.extendedVersion(extendedVersion);
+
+        final List<String> classNameList;
+        try {
+            classNameList = (List<String>) config.getOrDefault(TOKEN_CUSTOM, new ArrayList<String>());
+        } catch (Exception ex) {
+            throw new IllegalStateException(String.format("Invalid configuration value of [%s] for [%s] setting on %s serialization configuration",
+                    config.getOrDefault(TOKEN_CUSTOM, ""), TOKEN_CUSTOM, this.getClass().getName()), ex);
+        }
+
+        if (!classNameList.isEmpty()) {
+            final List<Pair<Class, Function<Kryo, Serializer>>> classList = classNameList.stream().map(serializerDefinition -> {
+                String className;
+                Optional<String> serializerName;
+                if (serializerDefinition.contains(";")) {
+                    final String[] split = serializerDefinition.split(";");
+                    if (split.length != 2)
+                        throw new IllegalStateException(String.format("Invalid format for serializer definition [%s] - expected <class>:<serializer-class>", serializerDefinition));
+
+                    className = split[0];
+                    serializerName = Optional.of(split[1]);
+                } else {
+                    serializerName = Optional.empty();
+                    className = serializerDefinition;
+                }
+
+                try {
+                    final Class clazz = Class.forName(className);
+                    final Serializer serializer;
+                    if (serializerName.isPresent()) {
+                        final Class serializerClazz = Class.forName(serializerName.get());
+                        serializer = (Serializer) serializerClazz.newInstance();
+                    } else
+                        serializer = null;
+
+                    return Pair.<Class, Function<Kryo, Serializer>>with(clazz, kryo -> serializer);
+                } catch (Exception ex) {
+                    throw new IllegalStateException("Class could not be found", ex);
+                }
+            }).collect(Collectors.toList());
+
+            classList.forEach(c -> builder.addCustom(c.getValue0(), c.getValue1()));
+        }
+
+        this.serializeToString = Boolean.parseBoolean(config.getOrDefault(TOKEN_SERIALIZE_RESULT_TO_STRING, "false").toString());
+
+        this.gryoMapper = builder.create();
+    }
+
+    @Override
+    public String[] mimeTypesSupported() {
+        return new String[]{this.serializeToString ? MIME_TYPE_STRINGD : MIME_TYPE};
+    }
+
+    @Override
+    public ResponseMessage deserializeResponse(final ByteBuf msg) throws SerializationException {
+        try {
+            final Kryo kryo = kryoThreadLocal.get();
+            final byte[] payload = new byte[msg.readableBytes()];
+            msg.readBytes(payload);
+            try (final Input input = new Input(payload)) {
+                final Map<String, Object> responseData = (Map<String, Object>) kryo.readClassAndObject(input);
+                final Map<String, Object> status = (Map<String, Object>) responseData.get(SerTokens.TOKEN_STATUS);
+                final Map<String, Object> result = (Map<String, Object>) responseData.get(SerTokens.TOKEN_RESULT);
+                return ResponseMessage.build(UUID.fromString(responseData.get(SerTokens.TOKEN_REQUEST).toString()))
+                        .code(ResponseStatusCode.getFromValue((Integer) status.get(SerTokens.TOKEN_CODE)))
+                        .statusMessage(Optional.ofNullable((String) status.get(SerTokens.TOKEN_MESSAGE)).orElse(""))
+                        .statusAttributes((Map<String, Object>) status.get(SerTokens.TOKEN_ATTRIBUTES))
+                        .result(result.get(SerTokens.TOKEN_DATA))
+                        .responseMetaData((Map<String, Object>) result.get(SerTokens.TOKEN_META))
+                        .create();
+            }
+        } catch (Exception ex) {
+            logger.warn("Response [{}] could not be deserialized by {}.", msg, GryoMessageSerializerV1d0.class.getName());
+            throw new SerializationException(ex);
+        }
+    }
+
+    @Override
+    public ByteBuf serializeResponseAsBinary(final ResponseMessage responseMessage, final ByteBufAllocator allocator) throws SerializationException {
+        ByteBuf encodedMessage = null;
+        try {
+            final Map<String, Object> result = new HashMap<>();
+            result.put(SerTokens.TOKEN_DATA, serializeToString ? serializeResultToString(responseMessage) : responseMessage.getResult().getData());
+            result.put(SerTokens.TOKEN_META, responseMessage.getResult().getMeta());
+
+            final Map<String, Object> status = new HashMap<>();
+            status.put(SerTokens.TOKEN_MESSAGE, responseMessage.getStatus().getMessage());
+            status.put(SerTokens.TOKEN_CODE, responseMessage.getStatus().getCode().getValue());
+            status.put(SerTokens.TOKEN_ATTRIBUTES, responseMessage.getStatus().getAttributes());
+
+            final Map<String, Object> message = new HashMap<>();
+            message.put(SerTokens.TOKEN_STATUS, status);
+            message.put(SerTokens.TOKEN_RESULT, result);
+            message.put(SerTokens.TOKEN_REQUEST, responseMessage.getRequestId() != null ? responseMessage.getRequestId() : null);
+
+            final Kryo kryo = kryoThreadLocal.get();
+            try (final OutputStream baos = new ByteArrayOutputStream()) {
+                final Output output = new Output(baos);
+                kryo.writeClassAndObject(output, message);
+
+                final long size = output.total();
+                if (size > Integer.MAX_VALUE)
+                    throw new SerializationException(String.format("Message size of %s exceeds allocatable space", size));
+
+                encodedMessage = allocator.buffer((int) output.total());
+                encodedMessage.writeBytes(output.toBytes());
+            }
+
+            return encodedMessage;
+        } catch (Exception ex) {
+            if (encodedMessage != null) ReferenceCountUtil.release(encodedMessage);
+
+            logger.warn("Response [{}] could not be serialized by {}.", responseMessage.toString(), GryoMessageSerializerV1d0.class.getName());
+            throw new SerializationException(ex);
+        }
+    }
+
+    @Override
+    public RequestMessage deserializeRequest(final ByteBuf msg) throws SerializationException {
+        try {
+            final Kryo kryo = kryoThreadLocal.get();
+            final byte[] payload = new byte[msg.readableBytes()];
+            msg.readBytes(payload);
+            try (final Input input = new Input(payload)) {
+                final Map<String, Object> requestData = (Map<String, Object>) kryo.readClassAndObject(input);
+                final RequestMessage.Builder builder = RequestMessage.build((String) requestData.get(SerTokens.TOKEN_OP))
+                        .overrideRequestId((UUID) requestData.get(SerTokens.TOKEN_REQUEST))
+                        .processor((String) requestData.get(SerTokens.TOKEN_PROCESSOR));
+                final Map<String, Object> args = (Map<String, Object>) requestData.get(SerTokens.TOKEN_ARGS);
+                args.forEach(builder::addArg);
+                return builder.create();
+            }
+        } catch (Exception ex) {
+            logger.warn("Request [{}] could not be deserialized by {}.", msg, GryoMessageSerializerV1d0.class.getName());
+            throw new SerializationException(ex);
+        }
+    }
+
+    @Override
+    public ByteBuf serializeRequestAsBinary(final RequestMessage requestMessage, final ByteBufAllocator allocator) throws SerializationException {
+        ByteBuf encodedMessage = null;
+        try {
+            final Kryo kryo = kryoThreadLocal.get();
+            try (final OutputStream baos = new ByteArrayOutputStream()) {
+                final Output output = new Output(baos);
+                final String mimeType = serializeToString ? MIME_TYPE_STRINGD : MIME_TYPE;
+                output.writeByte(mimeType.length());
+                output.write(mimeType.getBytes(UTF8));
+
+                final Map<String, Object> request = new HashMap<>();
+                request.put(SerTokens.TOKEN_REQUEST, requestMessage.getRequestId());
+                request.put(SerTokens.TOKEN_PROCESSOR, requestMessage.getProcessor());
+                request.put(SerTokens.TOKEN_OP, requestMessage.getOp());
+                request.put(SerTokens.TOKEN_ARGS, requestMessage.getArgs());
+
+                kryo.writeClassAndObject(output, request);
+
+                final long size = output.total();
+                if (size > Integer.MAX_VALUE)
+                    throw new SerializationException(String.format("Message size of %s exceeds allocatable space", size));
+
+                encodedMessage = allocator.buffer((int) size);
+                encodedMessage.writeBytes(output.toBytes());
+            }
+
+            return encodedMessage;
+        } catch (Exception ex) {
+            if (encodedMessage != null) ReferenceCountUtil.release(encodedMessage);
+
+            logger.warn("Request [{}] could not be serialized by {}.", requestMessage.toString(), GryoMessageSerializerV1d0.class.getName());
+            throw new SerializationException(ex);
+        }
+    }
+
+    private Object serializeResultToString(final ResponseMessage msg) {
+        if (msg.getResult() == null) return "null";
+        if (msg.getResult().getData() == null) return "null";
+
+        // the IteratorHandler should return a collection so keep it as such
+        final Object o = msg.getResult().getData();
+        if (o instanceof Collection) {
+            return ((Collection) o).stream().map(d -> null == d ? "null" : d.toString()).collect(Collectors.toList());
+        } else {
+            return o.toString();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/JsonBuilderGryoSerializer.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/JsonBuilderGryoSerializer.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/JsonBuilderGryoSerializer.java
new file mode 100644
index 0000000..6142b80
--- /dev/null
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/JsonBuilderGryoSerializer.java
@@ -0,0 +1,45 @@
+/*
+ * 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.driver.ser;
+
+import com.esotericsoftware.kryo.Kryo;
+import com.esotericsoftware.kryo.Serializer;
+import com.esotericsoftware.kryo.io.Input;
+import com.esotericsoftware.kryo.io.Output;
+import groovy.json.JsonBuilder;
+import groovy.json.JsonSlurper;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class JsonBuilderGryoSerializer extends Serializer<JsonBuilder> {
+
+    final JsonSlurper slurper = new JsonSlurper();
+
+    @Override
+    public void write(final Kryo kryo, final Output output, final JsonBuilder jsonBuilder) {
+        output.writeString(jsonBuilder.toString());
+    }
+
+    @Override
+    public JsonBuilder read(final Kryo kryo, final Input input, final Class<JsonBuilder> jsonBuilderClass) {
+        final String jsonString = input.readString();
+        return new JsonBuilder(slurper.parseText(jsonString));
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/JsonBuilderKryoSerializer.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/JsonBuilderKryoSerializer.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/JsonBuilderKryoSerializer.java
deleted file mode 100644
index 9881677..0000000
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/JsonBuilderKryoSerializer.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.driver.ser;
-
-import com.esotericsoftware.kryo.Kryo;
-import com.esotericsoftware.kryo.Serializer;
-import com.esotericsoftware.kryo.io.Input;
-import com.esotericsoftware.kryo.io.Output;
-import groovy.json.JsonBuilder;
-import groovy.json.JsonSlurper;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class JsonBuilderKryoSerializer extends Serializer<JsonBuilder> {
-
-    final JsonSlurper slurper = new JsonSlurper();
-
-    @Override
-    public void write(final Kryo kryo, final Output output, final JsonBuilder jsonBuilder) {
-        output.writeString(jsonBuilder.toString());
-    }
-
-    @Override
-    public JsonBuilder read(final Kryo kryo, final Input input, final Class<JsonBuilder> jsonBuilderClass) {
-        final String jsonString = input.readString();
-        return new JsonBuilder(slurper.parseText(jsonString));
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/KryoMessageSerializerV1d0.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/KryoMessageSerializerV1d0.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/KryoMessageSerializerV1d0.java
deleted file mode 100644
index 3f35a77..0000000
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/KryoMessageSerializerV1d0.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.driver.ser;
-
-import com.esotericsoftware.kryo.Kryo;
-import com.esotericsoftware.kryo.Serializer;
-import com.esotericsoftware.kryo.io.Input;
-import com.esotericsoftware.kryo.io.Output;
-import org.apache.tinkerpop.gremlin.driver.MessageSerializer;
-import org.apache.tinkerpop.gremlin.driver.message.RequestMessage;
-import org.apache.tinkerpop.gremlin.driver.message.ResponseMessage;
-import org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.io.kryo.KryoMapper;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.ByteBufAllocator;
-import io.netty.util.ReferenceCountUtil;
-import org.javatuples.Pair;
-
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStream;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.UUID;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class KryoMessageSerializerV1d0 implements MessageSerializer {
-    private KryoMapper kryoMapper;
-    private ThreadLocal<Kryo> kryoThreadLocal = new ThreadLocal<Kryo>() {
-        @Override
-        protected Kryo initialValue() {
-            return kryoMapper.createMapper();
-        }
-    };
-
-    private static final Charset UTF8 = Charset.forName("UTF-8");
-
-    private static final String MIME_TYPE = SerTokens.MIME_KRYO_V1D0;
-    private static final String MIME_TYPE_STRINGD = SerTokens.MIME_KRYO_V1D0 + "-stringd";
-
-    private static final String TOKEN_EXTENDED_VERSION = "extendedVersion";
-    private static final String TOKEN_CUSTOM = "custom";
-    private static final String TOKEN_SERIALIZE_RESULT_TO_STRING = "serializeResultToString";
-    private static final String TOKEN_USE_MAPPER_FROM_GRAPH = "useMapperFromGraph";
-
-    private boolean serializeToString;
-
-    /**
-     * Creates an instance with a standard {@link org.apache.tinkerpop.gremlin.structure.io.kryo.KryoMapper} instance. Note that this instance
-     * will be overriden by {@link #configure} is called.
-     */
-    public KryoMessageSerializerV1d0() {
-        kryoMapper = KryoMapper.build(KryoMapper.Version.V_1_0_0).create();
-    }
-
-    /**
-     * Creates an instance with a provided mapper configured {@link org.apache.tinkerpop.gremlin.structure.io.kryo.KryoMapper} instance. Note that this instance
-     * will be overriden by {@link #configure} is called.
-     */
-    public KryoMessageSerializerV1d0(final KryoMapper kryo) {
-        this.kryoMapper = kryo;
-    }
-
-    @Override
-    public void configure(final Map<String, Object> config, final Map<String, Graph> graphs) {
-        final byte extendedVersion;
-        try {
-            extendedVersion = Byte.parseByte(config.getOrDefault(TOKEN_EXTENDED_VERSION, KryoMapper.DEFAULT_EXTENDED_VERSION).toString());
-        } catch (Exception ex) {
-            throw new IllegalStateException(String.format("Invalid configuration value of [%s] for [%s] setting on %s serialization configuration",
-                    config.getOrDefault(TOKEN_EXTENDED_VERSION, ""), TOKEN_EXTENDED_VERSION, this.getClass().getName()), ex);
-        }
-
-        final KryoMapper.Builder initialBuilder;
-        final Object graphToUseForMapper = config.get(TOKEN_USE_MAPPER_FROM_GRAPH);
-        if (graphToUseForMapper != null) {
-            if (null == graphs) throw new IllegalStateException(String.format(
-                    "No graphs have been provided to the serializer and therefore %s is not a valid configuration", TOKEN_USE_MAPPER_FROM_GRAPH));
-
-            final Graph g = graphs.get(graphToUseForMapper.toString());
-            if (null == g) throw new IllegalStateException(String.format(
-                    "There is no graph named [%s] configured to be used in the %s setting",
-                    graphToUseForMapper, TOKEN_USE_MAPPER_FROM_GRAPH));
-
-            // a graph was found so use the mapper it constructs.  this allows kryo to be auto-configured with any
-            // custom classes that the implementation allows for
-            initialBuilder = g.io().kryoMapper();
-        } else {
-            // no graph was supplied so just use the default - this will likely be the case when using a graph
-            // with no custom classes or a situation where the user needs complete control like when using two
-            // distinct implementations each with their own custom classes.
-            initialBuilder = KryoMapper.build(KryoMapper.Version.V_1_0_0);
-        }
-
-        final KryoMapper.Builder builder = initialBuilder.extendedVersion(extendedVersion);
-
-        final List<String> classNameList;
-        try {
-            classNameList = (List<String>) config.getOrDefault(TOKEN_CUSTOM, new ArrayList<String>());
-        } catch (Exception ex) {
-            throw new IllegalStateException(String.format("Invalid configuration value of [%s] for [%s] setting on %s serialization configuration",
-                    config.getOrDefault(TOKEN_CUSTOM, ""), TOKEN_CUSTOM, this.getClass().getName()), ex);
-        }
-
-        if (!classNameList.isEmpty()) {
-            final List<Pair<Class, Function<Kryo, Serializer>>> classList = classNameList.stream().map(serializerDefinition -> {
-                String className;
-                Optional<String> serializerName;
-                if (serializerDefinition.contains(";")) {
-                    final String[] split = serializerDefinition.split(";");
-                    if (split.length != 2)
-                        throw new IllegalStateException(String.format("Invalid format for serializer definition [%s] - expected <class>:<serializer-class>", serializerDefinition));
-
-                    className = split[0];
-                    serializerName = Optional.of(split[1]);
-                } else {
-                    serializerName = Optional.empty();
-                    className = serializerDefinition;
-                }
-
-                try {
-                    final Class clazz = Class.forName(className);
-                    final Serializer serializer;
-                    if (serializerName.isPresent()) {
-                        final Class serializerClazz = Class.forName(serializerName.get());
-                        serializer = (Serializer) serializerClazz.newInstance();
-                    } else
-                        serializer = null;
-
-                    return Pair.<Class, Function<Kryo, Serializer>>with(clazz, kryo -> serializer);
-                } catch (Exception ex) {
-                    throw new IllegalStateException("Class could not be found", ex);
-                }
-            }).collect(Collectors.toList());
-
-            classList.forEach(c -> builder.addCustom(c.getValue0(), c.getValue1()));
-        }
-
-        this.serializeToString = Boolean.parseBoolean(config.getOrDefault(TOKEN_SERIALIZE_RESULT_TO_STRING, "false").toString());
-
-        this.kryoMapper = builder.create();
-    }
-
-    @Override
-    public String[] mimeTypesSupported() {
-        return new String[]{this.serializeToString ? MIME_TYPE_STRINGD : MIME_TYPE};
-    }
-
-    @Override
-    public ResponseMessage deserializeResponse(final ByteBuf msg) throws SerializationException {
-        try {
-            final Kryo kryo = kryoThreadLocal.get();
-            final byte[] payload = new byte[msg.readableBytes()];
-            msg.readBytes(payload);
-            try (final Input input = new Input(payload)) {
-                final Map<String, Object> responseData = (Map<String, Object>) kryo.readClassAndObject(input);
-                final Map<String, Object> status = (Map<String, Object>) responseData.get(SerTokens.TOKEN_STATUS);
-                final Map<String, Object> result = (Map<String, Object>) responseData.get(SerTokens.TOKEN_RESULT);
-                return ResponseMessage.build(UUID.fromString(responseData.get(SerTokens.TOKEN_REQUEST).toString()))
-                        .code(ResponseStatusCode.getFromValue((Integer) status.get(SerTokens.TOKEN_CODE)))
-                        .statusMessage(Optional.ofNullable((String) status.get(SerTokens.TOKEN_MESSAGE)).orElse(""))
-                        .statusAttributes((Map<String, Object>) status.get(SerTokens.TOKEN_ATTRIBUTES))
-                        .result(result.get(SerTokens.TOKEN_DATA))
-                        .responseMetaData((Map<String, Object>) result.get(SerTokens.TOKEN_META))
-                        .create();
-            }
-        } catch (Exception ex) {
-            logger.warn("Response [{}] could not be deserialized by {}.", msg, KryoMessageSerializerV1d0.class.getName());
-            throw new SerializationException(ex);
-        }
-    }
-
-    @Override
-    public ByteBuf serializeResponseAsBinary(final ResponseMessage responseMessage, final ByteBufAllocator allocator) throws SerializationException {
-        ByteBuf encodedMessage = null;
-        try {
-            final Map<String, Object> result = new HashMap<>();
-            result.put(SerTokens.TOKEN_DATA, serializeToString ? serializeResultToString(responseMessage) : responseMessage.getResult().getData());
-            result.put(SerTokens.TOKEN_META, responseMessage.getResult().getMeta());
-
-            final Map<String, Object> status = new HashMap<>();
-            status.put(SerTokens.TOKEN_MESSAGE, responseMessage.getStatus().getMessage());
-            status.put(SerTokens.TOKEN_CODE, responseMessage.getStatus().getCode().getValue());
-            status.put(SerTokens.TOKEN_ATTRIBUTES, responseMessage.getStatus().getAttributes());
-
-            final Map<String, Object> message = new HashMap<>();
-            message.put(SerTokens.TOKEN_STATUS, status);
-            message.put(SerTokens.TOKEN_RESULT, result);
-            message.put(SerTokens.TOKEN_REQUEST, responseMessage.getRequestId() != null ? responseMessage.getRequestId() : null);
-
-            final Kryo kryo = kryoThreadLocal.get();
-            try (final OutputStream baos = new ByteArrayOutputStream()) {
-                final Output output = new Output(baos);
-                kryo.writeClassAndObject(output, message);
-
-                final long size = output.total();
-                if (size > Integer.MAX_VALUE)
-                    throw new SerializationException(String.format("Message size of %s exceeds allocatable space", size));
-
-                encodedMessage = allocator.buffer((int) output.total());
-                encodedMessage.writeBytes(output.toBytes());
-            }
-
-            return encodedMessage;
-        } catch (Exception ex) {
-            if (encodedMessage != null) ReferenceCountUtil.release(encodedMessage);
-
-            logger.warn("Response [{}] could not be serialized by {}.", responseMessage.toString(), KryoMessageSerializerV1d0.class.getName());
-            throw new SerializationException(ex);
-        }
-    }
-
-    @Override
-    public RequestMessage deserializeRequest(final ByteBuf msg) throws SerializationException {
-        try {
-            final Kryo kryo = kryoThreadLocal.get();
-            final byte[] payload = new byte[msg.readableBytes()];
-            msg.readBytes(payload);
-            try (final Input input = new Input(payload)) {
-                final Map<String, Object> requestData = (Map<String, Object>) kryo.readClassAndObject(input);
-                final RequestMessage.Builder builder = RequestMessage.build((String) requestData.get(SerTokens.TOKEN_OP))
-                        .overrideRequestId((UUID) requestData.get(SerTokens.TOKEN_REQUEST))
-                        .processor((String) requestData.get(SerTokens.TOKEN_PROCESSOR));
-                final Map<String, Object> args = (Map<String, Object>) requestData.get(SerTokens.TOKEN_ARGS);
-                args.forEach(builder::addArg);
-                return builder.create();
-            }
-        } catch (Exception ex) {
-            logger.warn("Request [{}] could not be deserialized by {}.", msg, KryoMessageSerializerV1d0.class.getName());
-            throw new SerializationException(ex);
-        }
-    }
-
-    @Override
-    public ByteBuf serializeRequestAsBinary(final RequestMessage requestMessage, final ByteBufAllocator allocator) throws SerializationException {
-        ByteBuf encodedMessage = null;
-        try {
-            final Kryo kryo = kryoThreadLocal.get();
-            try (final OutputStream baos = new ByteArrayOutputStream()) {
-                final Output output = new Output(baos);
-                final String mimeType = serializeToString ? MIME_TYPE_STRINGD : MIME_TYPE;
-                output.writeByte(mimeType.length());
-                output.write(mimeType.getBytes(UTF8));
-
-                final Map<String, Object> request = new HashMap<>();
-                request.put(SerTokens.TOKEN_REQUEST, requestMessage.getRequestId());
-                request.put(SerTokens.TOKEN_PROCESSOR, requestMessage.getProcessor());
-                request.put(SerTokens.TOKEN_OP, requestMessage.getOp());
-                request.put(SerTokens.TOKEN_ARGS, requestMessage.getArgs());
-
-                kryo.writeClassAndObject(output, request);
-
-                final long size = output.total();
-                if (size > Integer.MAX_VALUE)
-                    throw new SerializationException(String.format("Message size of %s exceeds allocatable space", size));
-
-                encodedMessage = allocator.buffer((int) size);
-                encodedMessage.writeBytes(output.toBytes());
-            }
-
-            return encodedMessage;
-        } catch (Exception ex) {
-            if (encodedMessage != null) ReferenceCountUtil.release(encodedMessage);
-
-            logger.warn("Request [{}] could not be serialized by {}.", requestMessage.toString(), KryoMessageSerializerV1d0.class.getName());
-            throw new SerializationException(ex);
-        }
-    }
-
-    private Object serializeResultToString(final ResponseMessage msg) {
-        if (msg.getResult() == null) return "null";
-        if (msg.getResult().getData() == null) return "null";
-
-        // the IteratorHandler should return a collection so keep it as such
-        final Object o = msg.getResult().getData();
-        if (o instanceof Collection) {
-            return ((Collection) o).stream().map(d -> null == d ? "null" : d.toString()).collect(Collectors.toList());
-        } else {
-            return o.toString();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/SerTokens.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/SerTokens.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/SerTokens.java
index f2a5a46..1fcb4be 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/SerTokens.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/SerTokens.java
@@ -36,5 +36,5 @@ public class SerTokens {
 
     public static final String MIME_JSON = "application/json";
     public static final String MIME_JSON_V1D0 = "application/vnd.gremlin-v1.0+json";
-    public static final String MIME_KRYO_V1D0 = "application/vnd.gremlin-v1.0+kryo";
+    public static final String MIME_GRYO_V1D0 = "application/vnd.gremlin-v1.0+gryo";
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/Serializers.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/Serializers.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/Serializers.java
index 4deab4b..a48be1b 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/Serializers.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/Serializers.java
@@ -28,7 +28,7 @@ import org.apache.tinkerpop.gremlin.driver.MessageSerializer;
 public enum Serializers {
     JSON(SerTokens.MIME_JSON),
     JSON_V1D0(SerTokens.MIME_JSON_V1D0),
-    KRYO_V1D0(SerTokens.MIME_KRYO_V1D0);
+    GRYO_V1D0(SerTokens.MIME_GRYO_V1D0);
 
     private String value;
 
@@ -60,8 +60,8 @@ public enum Serializers {
                 return new JsonMessageSerializerV1d0();
             case SerTokens.MIME_JSON_V1D0:
                 return new JsonMessageSerializerGremlinV1d0();
-            case SerTokens.MIME_KRYO_V1D0:
-                return new KryoMessageSerializerV1d0();
+            case SerTokens.MIME_GRYO_V1D0:
+                return new GryoMessageSerializerV1d0();
             default:
                 throw new RuntimeException("Could not create a simple MessageSerializer instance of " + value);
         }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/simple/NioClient.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/simple/NioClient.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/simple/NioClient.java
index dd2b358..dbac010 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/simple/NioClient.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/simple/NioClient.java
@@ -23,7 +23,7 @@ import org.apache.tinkerpop.gremlin.driver.handler.NioGremlinRequestEncoder;
 import org.apache.tinkerpop.gremlin.driver.handler.NioGremlinResponseDecoder;
 import org.apache.tinkerpop.gremlin.driver.message.RequestMessage;
 import org.apache.tinkerpop.gremlin.driver.message.ResponseMessage;
-import org.apache.tinkerpop.gremlin.driver.ser.KryoMessageSerializerV1d0;
+import org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0;
 import io.netty.bootstrap.Bootstrap;
 import io.netty.channel.Channel;
 import io.netty.channel.ChannelHandlerContext;
@@ -62,7 +62,7 @@ public class NioClient implements SimpleClient {
         final Bootstrap b = new Bootstrap().group(group);
 
         try {
-            final MessageSerializer serializer = new KryoMessageSerializerV1d0();
+            final MessageSerializer serializer = new GryoMessageSerializerV1d0();
             b.channel(NioSocketChannel.class)
                     .handler(new ChannelInitializer<SocketChannel>() {
                         @Override

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/simple/WebSocketClient.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/simple/WebSocketClient.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/simple/WebSocketClient.java
index dac8cd3..1546cde 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/simple/WebSocketClient.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/simple/WebSocketClient.java
@@ -24,7 +24,7 @@ import org.apache.tinkerpop.gremlin.driver.handler.WebSocketGremlinRequestEncode
 import org.apache.tinkerpop.gremlin.driver.handler.WebSocketGremlinResponseDecoder;
 import org.apache.tinkerpop.gremlin.driver.message.RequestMessage;
 import org.apache.tinkerpop.gremlin.driver.message.ResponseMessage;
-import org.apache.tinkerpop.gremlin.driver.ser.KryoMessageSerializerV1d0;
+import org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0;
 import io.netty.bootstrap.Bootstrap;
 import io.netty.channel.Channel;
 import io.netty.channel.ChannelHandlerContext;
@@ -76,7 +76,7 @@ public class WebSocketClient implements SimpleClient {
                     new WebSocketClientHandler(
                             WebSocketClientHandshakerFactory.newHandshaker(
                                     uri, WebSocketVersion.V13, null, false, new DefaultHttpHeaders()));
-            final MessageSerializer serializer = new KryoMessageSerializerV1d0();
+            final MessageSerializer serializer = new GryoMessageSerializerV1d0();
             b.channel(NioSocketChannel.class)
                     .handler(new ChannelInitializer<SocketChannel>() {
                         @Override


[7/8] incubator-tinkerpop git commit: Renamed Gremlin Kryo to simply Gryo.

Posted by ok...@apache.org.
Renamed Gremlin Kryo to simply Gryo.

The .gio extensions are now renamed to .kryo.


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

Branch: refs/heads/spark
Commit: 929a2889c3ec75ff2b315200bc5abdd001bc4fcd
Parents: 9bdb5e7
Author: Stephen Mallette <sp...@apache.org>
Authored: Tue Mar 3 12:22:28 2015 -0500
Committer: Stephen Mallette <sp...@apache.org>
Committed: Tue Mar 3 12:22:28 2015 -0500

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |   1 +
 data/grateful-dead-vertices.gio                 | Bin 1028298 -> 0 bytes
 data/grateful-dead-vertices.kryo                | Bin 0 -> 1028298 bytes
 data/grateful-dead.gio                          | Bin 515409 -> 0 bytes
 data/grateful-dead.kryo                         | Bin 0 -> 515409 bytes
 data/tinkerpop-classic-vertices.gio             | Bin 1323 -> 0 bytes
 data/tinkerpop-classic-vertices.kryo            | Bin 0 -> 1323 bytes
 data/tinkerpop-classic.gio                      | Bin 817 -> 0 bytes
 data/tinkerpop-classic.kryo                     | Bin 0 -> 817 bytes
 data/tinkerpop-crew-vertices.gio                | Bin 2743 -> 0 bytes
 data/tinkerpop-crew-vertices.kryo               | Bin 0 -> 2743 bytes
 data/tinkerpop-crew.gio                         | Bin 1916 -> 0 bytes
 data/tinkerpop-crew.kryo                        | Bin 0 -> 1916 bytes
 data/tinkerpop-modern-vertices.gio              | Bin 1439 -> 0 bytes
 data/tinkerpop-modern-vertices.kryo             | Bin 0 -> 1439 bytes
 data/tinkerpop-modern.gio                       | Bin 877 -> 0 bytes
 data/tinkerpop-modern.kryo                      | Bin 0 -> 877 bytes
 docs/src/implementations.asciidoc               |  14 +-
 docs/src/the-graph.asciidoc                     |  18 +-
 gremlin-console/conf/remote-objects.yaml        |   2 +-
 gremlin-console/conf/remote.yaml                |   2 +-
 .../plugin/gremlin-server-integration.yaml      |   4 +-
 .../gremlin/console/groovy/plugin/remote.yaml   |   2 +-
 .../util/metric/DependantMutableMetrics.java    |   2 +-
 .../process/util/metric/MutableMetrics.java     |   2 +-
 .../tinkerpop/gremlin/structure/Graph.java      |  50 +--
 .../gremlin/structure/io/DefaultIo.java         |   8 +-
 .../gremlin/structure/io/GraphMigrator.java     |  18 +-
 .../structure/io/gryo/EdgeTerminator.java       |  48 +++
 .../structure/io/gryo/EntrySerializer.java      |  43 ++
 .../structure/io/gryo/GraphSerializer.java      | 164 ++++++++
 .../structure/io/gryo/GremlinClassResolver.java | 206 ++++++++++
 .../gremlin/structure/io/gryo/GryoMapper.java   | 406 +++++++++++++++++++
 .../gremlin/structure/io/gryo/GryoReader.java   | 400 ++++++++++++++++++
 .../gremlin/structure/io/gryo/GryoWriter.java   | 180 ++++++++
 .../structure/io/gryo/URISerializer.java        |  46 +++
 .../structure/io/gryo/UUIDSerializer.java       |  46 +++
 .../io/gryo/VertexByteArrayInputStream.java     |  74 ++++
 .../structure/io/gryo/VertexTerminator.java     |  53 +++
 .../structure/io/kryo/EdgeTerminator.java       |  48 ---
 .../structure/io/kryo/EntrySerializer.java      |  43 --
 .../structure/io/kryo/GraphSerializer.java      | 164 --------
 .../structure/io/kryo/GremlinClassResolver.java | 206 ----------
 .../gremlin/structure/io/kryo/KryoMapper.java   | 406 -------------------
 .../gremlin/structure/io/kryo/KryoReader.java   | 400 ------------------
 .../gremlin/structure/io/kryo/KryoWriter.java   | 180 --------
 .../structure/io/kryo/URISerializer.java        |  46 ---
 .../structure/io/kryo/UUIDSerializer.java       |  46 ---
 .../io/kryo/VertexByteArrayInputStream.java     |  74 ----
 .../structure/io/kryo/VertexTerminator.java     |  53 ---
 .../tinkerpop/gremlin/driver/Cluster.java       |   2 +-
 .../driver/ser/GryoMessageSerializerV1d0.java   | 307 ++++++++++++++
 .../driver/ser/JsonBuilderGryoSerializer.java   |  45 ++
 .../driver/ser/JsonBuilderKryoSerializer.java   |  45 --
 .../driver/ser/KryoMessageSerializerV1d0.java   | 307 --------------
 .../tinkerpop/gremlin/driver/ser/SerTokens.java |   2 +-
 .../gremlin/driver/ser/Serializers.java         |   6 +-
 .../gremlin/driver/simple/NioClient.java        |   4 +-
 .../gremlin/driver/simple/WebSocketClient.java  |   4 +-
 .../ser/GryoMessageSerializerV1D0Test.java      | 294 ++++++++++++++
 .../ser/KryoMessageSerializerV1d0Test.java      | 294 --------------
 .../AbstractImportCustomizerProvider.java       |   4 +-
 gremlin-server/conf/gremlin-server-classic.yaml |   4 +-
 gremlin-server/conf/gremlin-server-modern.yaml  |   4 +-
 gremlin-server/conf/gremlin-server-neo4j.yaml   |   4 +-
 gremlin-server/conf/gremlin-server.yaml         |   4 +-
 .../server/GremlinAdditionPerformanceTest.java  |   2 +-
 .../server/GremlinDriverIntegrateTest.java      |  10 +-
 .../server/gremlin-server-integration.yaml      |   4 +-
 .../server/gremlin-server-performance.yaml      |   2 +-
 .../gremlin/AbstractGraphProvider.java          |   8 +-
 .../apache/tinkerpop/gremlin/LoadGraphWith.java |  10 +-
 .../structure/GraphWritePerformanceTest.java    |   6 +-
 .../tinkerpop/gremlin/structure/IoTest.java     | 180 ++++----
 .../gremlin/structure/SerializationTest.java    |  27 +-
 .../structure/io/gryo/GryoResourceAccess.java   |  27 ++
 .../structure/io/kryo/KryoResourceAccess.java   |  27 --
 .../io/gryo/grateful-dead-vertices.kryo         | Bin 0 -> 1028298 bytes
 .../structure/io/gryo/grateful-dead.kryo        | Bin 0 -> 515409 bytes
 .../io/gryo/tinkerpop-classic-vertices.kryo     | Bin 0 -> 1323 bytes
 .../structure/io/gryo/tinkerpop-classic.kryo    | Bin 0 -> 817 bytes
 .../io/gryo/tinkerpop-crew-vertices.kryo        | Bin 0 -> 2743 bytes
 .../structure/io/gryo/tinkerpop-crew.kryo       | Bin 0 -> 1916 bytes
 .../io/gryo/tinkerpop-modern-vertices.kryo      | Bin 0 -> 1439 bytes
 .../structure/io/gryo/tinkerpop-modern.kryo     | Bin 0 -> 877 bytes
 .../io/kryo/grateful-dead-vertices.gio          | Bin 1028298 -> 0 bytes
 .../gremlin/structure/io/kryo/grateful-dead.gio | Bin 515409 -> 0 bytes
 .../io/kryo/tinkerpop-classic-vertices.gio      | Bin 1323 -> 0 bytes
 .../structure/io/kryo/tinkerpop-classic.gio     | Bin 817 -> 0 bytes
 .../io/kryo/tinkerpop-crew-vertices.gio         | Bin 2743 -> 0 bytes
 .../structure/io/kryo/tinkerpop-crew.gio        | Bin 1916 -> 0 bytes
 .../io/kryo/tinkerpop-modern-vertices.gio       | Bin 1439 -> 0 bytes
 .../structure/io/kryo/tinkerpop-modern.gio      | Bin 877 -> 0 bytes
 .../structure/io/gryo/GryoMapperTest.java       |  34 ++
 .../structure/io/kryo/KryoMapperTest.java       |  34 --
 hadoop-gremlin/conf/hadoop-gryo.properties      |  31 ++
 hadoop-gremlin/conf/hadoop-kryo.properties      |  31 --
 .../groovy/plugin/HadoopGremlinPlugin.java      |   4 +-
 .../computer/giraph/GiraphComputeVertex.java    |   8 +-
 .../process/computer/giraph/RuleWritable.java   |   4 +-
 .../hadoop/structure/io/ObjectWritable.java     |   4 +-
 .../hadoop/structure/io/VertexWritable.java     |   8 +-
 .../structure/io/gryo/GryoInputFormat.java      |  63 +++
 .../structure/io/gryo/GryoOutputFormat.java     |  43 ++
 .../structure/io/gryo/GryoRecordReader.java     | 113 ++++++
 .../structure/io/gryo/GryoRecordWriter.java     |  54 +++
 .../structure/io/gryo/VertexStreamIterator.java | 147 +++++++
 .../structure/io/kryo/KryoInputFormat.java      |  63 ---
 .../structure/io/kryo/KryoOutputFormat.java     |  43 --
 .../structure/io/kryo/KryoRecordReader.java     | 113 ------
 .../structure/io/kryo/KryoRecordWriter.java     |  54 ---
 .../structure/io/kryo/VertexStreamIterator.java | 147 -------
 .../gremlin/hadoop/HadoopGraphProvider.java     |  30 +-
 .../io/graphson/VertexStreamIteratorTest.java   |   6 +-
 .../io/gryo/GryoRecordReaderWriterTest.java     | 113 ++++++
 .../io/kryo/KryoRecordReaderWriterTest.java     | 113 ------
 pom.xml                                         |   2 +-
 tinkergraph-gremlin/pom.xml                     |   6 +-
 .../tinkergraph/structure/TinkerGraphTest.java  |  55 ++-
 119 files changed, 3205 insertions(+), 3206 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index d568d64..87fab47 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -25,6 +25,7 @@ image::http://www.tinkerpop.com/docs/current/images/gremlin-hindu.png[width=225]
 TinkerPop 3.0.0.M8 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* Renamed "Gremlin Kryo" to "Gryo".
 * Implement profiling for nested traversals.
 * Removed `Reducing.Reducer` and `ReducingStrategy`. Previous `Reducing` classes are now `MapReducer` classes.
 * Refactored the "process" test suite to allow for better test configuration with respect to different `TraversalEngine` implementations.

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/data/grateful-dead-vertices.gio
----------------------------------------------------------------------
diff --git a/data/grateful-dead-vertices.gio b/data/grateful-dead-vertices.gio
deleted file mode 100644
index 2031c24..0000000
Binary files a/data/grateful-dead-vertices.gio and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/data/grateful-dead-vertices.kryo
----------------------------------------------------------------------
diff --git a/data/grateful-dead-vertices.kryo b/data/grateful-dead-vertices.kryo
new file mode 100644
index 0000000..2031c24
Binary files /dev/null and b/data/grateful-dead-vertices.kryo differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/data/grateful-dead.gio
----------------------------------------------------------------------
diff --git a/data/grateful-dead.gio b/data/grateful-dead.gio
deleted file mode 100644
index 97143b1..0000000
Binary files a/data/grateful-dead.gio and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/data/grateful-dead.kryo
----------------------------------------------------------------------
diff --git a/data/grateful-dead.kryo b/data/grateful-dead.kryo
new file mode 100644
index 0000000..97143b1
Binary files /dev/null and b/data/grateful-dead.kryo differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/data/tinkerpop-classic-vertices.gio
----------------------------------------------------------------------
diff --git a/data/tinkerpop-classic-vertices.gio b/data/tinkerpop-classic-vertices.gio
deleted file mode 100644
index 33f8766..0000000
Binary files a/data/tinkerpop-classic-vertices.gio and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/data/tinkerpop-classic-vertices.kryo
----------------------------------------------------------------------
diff --git a/data/tinkerpop-classic-vertices.kryo b/data/tinkerpop-classic-vertices.kryo
new file mode 100644
index 0000000..33f8766
Binary files /dev/null and b/data/tinkerpop-classic-vertices.kryo differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/data/tinkerpop-classic.gio
----------------------------------------------------------------------
diff --git a/data/tinkerpop-classic.gio b/data/tinkerpop-classic.gio
deleted file mode 100644
index e2f72c6..0000000
Binary files a/data/tinkerpop-classic.gio and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/data/tinkerpop-classic.kryo
----------------------------------------------------------------------
diff --git a/data/tinkerpop-classic.kryo b/data/tinkerpop-classic.kryo
new file mode 100644
index 0000000..e2f72c6
Binary files /dev/null and b/data/tinkerpop-classic.kryo differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/data/tinkerpop-crew-vertices.gio
----------------------------------------------------------------------
diff --git a/data/tinkerpop-crew-vertices.gio b/data/tinkerpop-crew-vertices.gio
deleted file mode 100644
index 8289cd8..0000000
Binary files a/data/tinkerpop-crew-vertices.gio and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/data/tinkerpop-crew-vertices.kryo
----------------------------------------------------------------------
diff --git a/data/tinkerpop-crew-vertices.kryo b/data/tinkerpop-crew-vertices.kryo
new file mode 100644
index 0000000..8289cd8
Binary files /dev/null and b/data/tinkerpop-crew-vertices.kryo differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/data/tinkerpop-crew.gio
----------------------------------------------------------------------
diff --git a/data/tinkerpop-crew.gio b/data/tinkerpop-crew.gio
deleted file mode 100644
index 3e8ac2d..0000000
Binary files a/data/tinkerpop-crew.gio and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/data/tinkerpop-crew.kryo
----------------------------------------------------------------------
diff --git a/data/tinkerpop-crew.kryo b/data/tinkerpop-crew.kryo
new file mode 100644
index 0000000..3e8ac2d
Binary files /dev/null and b/data/tinkerpop-crew.kryo differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/data/tinkerpop-modern-vertices.gio
----------------------------------------------------------------------
diff --git a/data/tinkerpop-modern-vertices.gio b/data/tinkerpop-modern-vertices.gio
deleted file mode 100644
index 760e4d4..0000000
Binary files a/data/tinkerpop-modern-vertices.gio and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/data/tinkerpop-modern-vertices.kryo
----------------------------------------------------------------------
diff --git a/data/tinkerpop-modern-vertices.kryo b/data/tinkerpop-modern-vertices.kryo
new file mode 100644
index 0000000..760e4d4
Binary files /dev/null and b/data/tinkerpop-modern-vertices.kryo differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/data/tinkerpop-modern.gio
----------------------------------------------------------------------
diff --git a/data/tinkerpop-modern.gio b/data/tinkerpop-modern.gio
deleted file mode 100644
index 05e6101..0000000
Binary files a/data/tinkerpop-modern.gio and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/data/tinkerpop-modern.kryo
----------------------------------------------------------------------
diff --git a/data/tinkerpop-modern.kryo b/data/tinkerpop-modern.kryo
new file mode 100644
index 0000000..05e6101
Binary files /dev/null and b/data/tinkerpop-modern.kryo differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/docs/src/implementations.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/implementations.asciidoc b/docs/src/implementations.asciidoc
index 2911166..5869c5a 100644
--- a/docs/src/implementations.asciidoc
+++ b/docs/src/implementations.asciidoc
@@ -557,7 +557,7 @@ NeoTechnology are the creators of the graph pattern-match query language link:ht
 [source,groovy]
 gremlin> g = Neo4jGraph.open('/tmp/neo4j')
 ==>neo4jgraph[EmbeddedGraphDatabase [/tmp/neo4j]]
-gremlin> g.io().readKryo('data/tinkerpop-modern.gio')
+gremlin> g.io().readGryo('data/tinkerpop-modern.kryo')
 ==>null
 gremlin> g.cypher('MATCH (a {name:"marko"}) RETURN a')
 ==>[a:v[0]]
@@ -662,7 +662,7 @@ Properties Files
 
 [source,text]
 gremlin.graph=org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph
-gremlin.hadoop.inputLocation=tinkerpop-modern-vertices.gio
+gremlin.hadoop.inputLocation=tinkerpop-modern-vertices.kryo
 gremlin.hadoop.graphInputFormat=org.apache.tinkerpop.gremlin.hadoop.structure.io.kryo.KryoInputFormat
 gremlin.hadoop.outputLocation=output
 gremlin.hadoop.graphOutputFormat=org.apache.tinkerpop.gremlin.hadoop.structure.io.kryo.KryoOutputFormat
@@ -705,12 +705,12 @@ image:hadoop-pipes.png[width=180,float=left] It is possible to execute OLTP oper
 CAUTION: OLTP operations on `HadoopGraph` are not efficient. They require linear scans to execute and are unreasonable for large graphs. In such large graph situations, make use of <<traversalvertexprogram,TraversalVertexProgram>> which is the OLAP implementation of the Gremlin language. Hadoop-Gremlin provides various `GraphComputer` implementations to execute OLAP computations over a `HadoopGraph`.
 
 [source,text]
-gremlin> hdfs.copyFromLocal('data/tinkerpop-modern-vertices.gio', 'tinkerpop-modern-vertices.gio')
+gremlin> hdfs.copyFromLocal('data/tinkerpop-modern-vertices.kryo', 'tinkerpop-modern-vertices.kryo')
 ==>null
 gremlin> hdfs.ls()
-==>rw-r--r-- marko supergroup 1439 tinkerpop-modern-vertices.gio
-gremlin> g = GraphFactory.open('../../../hadoop-gremlin/conf/hadoop-kryo.properties')
-==>hadoopgraph[kryoinputformat->kryooutputformat]
+==>rw-r--r-- marko supergroup 1439 tinkerpop-modern-vertices.kryo
+gremlin> g = GraphFactory.open('../../../hadoop-gremlin/conf/hadoop-gryo.properties')
+==>hadoopgraph[gryoinputformat->gryooutputformat]
 gremlin> g.V().count()
 ==>6
 gremlin> g.V().out().out().values('name')
@@ -830,7 +830,7 @@ The distributed file system of Hadoop is called link:http://en.wikipedia.org/wik
 [source,text]
 gremlin> hdfs.ls()
 ==>rwxr-xr-x marko supergroup 0 (D) output
-==>rw-r--r-- marko supergroup 1439 tinkerpop-modern-vertices.gio
+==>rw-r--r-- marko supergroup 1439 tinkerpop-modern-vertices.kryo
 gremlin> hdfs.ls('output')
 ==>rwxr-xr-x marko supergroup 0 (D) a
 ==>rwxr-xr-x marko supergroup 0 (D) ~g

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/docs/src/the-graph.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/the-graph.asciidoc b/docs/src/the-graph.asciidoc
index 8d89f14..b380125 100644
--- a/docs/src/the-graph.asciidoc
+++ b/docs/src/the-graph.asciidoc
@@ -652,7 +652,7 @@ In the above code, the `embedTypes` option is set to `true` and the output below
 The ambiguity of components of the GraphSON is now removed by the `@class` property, which contains Java class information for the data it is associated with.  The `@class` property is used for all non-final types, with the exception of a small number of "natural" types (String, Boolean, Integer, and Double) which can be correctly inferred from JSON typing.  While the output is more verbose, it comes with the security of not losing type information.  While non-JVM languages won't be able to consume this information automatically, at least there is a hint as to how the values should be coerced back into the correct types in the target language.
 
 [[gremlin-kryo]]
-Kryo Reader/Writer
+Gryo Reader/Writer
 ~~~~~~~~~~~~~~~~~~
 
 image:gremlin-kryo.png[width=400,float=left] link:https://github.com/EsotericSoftware/kryo[Kryo] is a popular serialization package for the JVM. Gremlin-Kryo is a binary Graph serialization format for use on the JVM by JVM languages. It is designed to be space efficient, non-lossy and is promoted as the standard format to use when working with graph data inside of the TinkerPop stack. A list of common use cases is presented below:
@@ -663,16 +663,16 @@ image:gremlin-kryo.png[width=400,float=left] link:https://github.com/EsotericSof
 
 CAUTION: When migrating between Gremlin Structure implementations, Kryo may not lose data, but it is important to consider the features of each `Graph` and whether or not the data types supported in one will be supported in the other.  Failure to do so, may result in errors.
 
-Kryo supports all of the `GraphReader` and `GraphWriter` interface methods and can therefore read or write an entire `Graph`, a single `Vertex` or a single `Edge`.  The following code shows how to write a `Graph` instance to file called `tinkerpop-modern.gio` and then how to read that file back into a different instance:
+Kryo supports all of the `GraphReader` and `GraphWriter` interface methods and can therefore read or write an entire `Graph`, a single `Vertex` or a single `Edge`.  The following code shows how to write a `Graph` instance to file called `tinkerpop-modern.kryo` and then how to read that file back into a different instance:
 
 
 [source,java]
 ----
 final Graph g = TinkerFactory.createModern();
-g.io().writeKryo("tinkerpop-modern.gio");
+g.io().writeGryo("tinkerpop-modern.kryo");
 
 final Graph newGraph = TinkerGraph.open();
-newGraph.io().readKryo("tinkerpop-modern.gio")'
+newGraph.io().readGryo("tinkerpop-modern.kryo")'
 ----
 
 If a custom configuration is required, then have the `Graph` generate a `GraphReader` or `GraphWriter` "builder" instance:
@@ -680,17 +680,17 @@ If a custom configuration is required, then have the `Graph` generate a `GraphRe
 [source,java]
 ----
 final Graph g = TinkerFactory.createModern();
-try (final OutputStream os = new FileOutputStream("tinkerpop-modern.gio")) {
-    g.io().kryoWriter().create().writeGraph(os);
+try (final OutputStream os = new FileOutputStream("tinkerpop-modern.kryo")) {
+    g.io().gryoWriter().create().writeGraph(os);
 }
 
 final Graph newGraph = TinkerGraph.open();
-try (final InputStream stream = new FileInputStream("tinkerpop-modern.gio")) {
-    newGraph.io().kryoReader().vertexIdKey("name").create().readGraph(stream);
+try (final InputStream stream = new FileInputStream("tinkerpop-modern.kryo")) {
+    newGraph.io().gryoReader().vertexIdKey("name").create().readGraph(stream);
 }
 ----
 
-NOTE: The preferred extension for files names produced by Kryo is `.gio`.
+NOTE: The preferred extension for files names produced by Gryo is `.kryo`.
 
 TinkerPop2 Data Migration
 ~~~~~~~~~~~~~~~~~~~~~~~~~

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-console/conf/remote-objects.yaml
----------------------------------------------------------------------
diff --git a/gremlin-console/conf/remote-objects.yaml b/gremlin-console/conf/remote-objects.yaml
index be5f83a..78424fd 100644
--- a/gremlin-console/conf/remote-objects.yaml
+++ b/gremlin-console/conf/remote-objects.yaml
@@ -17,4 +17,4 @@
 
 hosts: [localhost]
 port: 8182
-serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.KryoMessageSerializerV1d0}
\ No newline at end of file
+serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-console/conf/remote.yaml
----------------------------------------------------------------------
diff --git a/gremlin-console/conf/remote.yaml b/gremlin-console/conf/remote.yaml
index 5e9ea87..7b23779 100644
--- a/gremlin-console/conf/remote.yaml
+++ b/gremlin-console/conf/remote.yaml
@@ -17,4 +17,4 @@
 
 hosts: [localhost]
 port: 8182
-serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.KryoMessageSerializerV1d0, config: { serializeResultToString: true }}
\ No newline at end of file
+serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/gremlin-server-integration.yaml
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/gremlin-server-integration.yaml b/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/gremlin-server-integration.yaml
index 7bb082e..124408f 100644
--- a/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/gremlin-server-integration.yaml
+++ b/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/gremlin-server-integration.yaml
@@ -34,8 +34,8 @@ scriptEngines: {
       imports: [java.lang.Math],
       staticImports: [java.lang.Math.PI]}}
 serializers:
-  - { className: org.apache.tinkerpop.gremlin.driver.ser.KryoMessageSerializerV1d0, config: { custom: [groovy.json.JsonBuilder;org.apache.tinkerpop.gremlin.driver.ser.JsonBuilderKryoSerializer]}}
-  - { className: org.apache.tinkerpop.gremlin.driver.ser.KryoMessageSerializerV1d0, config: { serializeResultToString: true}}
+  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { custom: [groovy.json.JsonBuilder;org.apache.tinkerpop.gremlin.driver.ser.JsonBuilderGryoSerializer]}}
+  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true}}
   - { className: org.apache.tinkerpop.gremlin.driver.ser.JsonMessageSerializerGremlinV1d0 }
   - { className: org.apache.tinkerpop.gremlin.driver.ser.JsonMessageSerializerV1d0 }
 processors:

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/remote.yaml
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/remote.yaml b/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/remote.yaml
index 5e9ea87..7b23779 100644
--- a/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/remote.yaml
+++ b/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/remote.yaml
@@ -17,4 +17,4 @@
 
 hosts: [localhost]
 port: 8182
-serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.KryoMessageSerializerV1d0, config: { serializeResultToString: true }}
\ No newline at end of file
+serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/util/metric/DependantMutableMetrics.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/util/metric/DependantMutableMetrics.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/util/metric/DependantMutableMetrics.java
index 42eb270..7bb5c4d 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/util/metric/DependantMutableMetrics.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/util/metric/DependantMutableMetrics.java
@@ -29,7 +29,7 @@ public class DependantMutableMetrics extends MutableMetrics {
     private DependantMutableMetrics upStreamMetrics;
 
     private DependantMutableMetrics() {
-        // necessary for kryo serialization
+        // necessary for gryo serialization
         super();
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/util/metric/MutableMetrics.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/util/metric/MutableMetrics.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/util/metric/MutableMetrics.java
index 5d20540..d84ed40 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/util/metric/MutableMetrics.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/util/metric/MutableMetrics.java
@@ -33,7 +33,7 @@ public class MutableMetrics extends ImmutableMetrics implements Cloneable {
     private long tempTime = -1l;
 
     protected MutableMetrics() {
-        // necessary for kryo serialization
+        // necessary for gryo serialization
     }
 
     public MutableMetrics(final String id, final String name) {

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
index 0d516ee..6ede86f 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
@@ -32,9 +32,9 @@ import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLWriter;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONReader;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter;
-import org.apache.tinkerpop.gremlin.structure.io.kryo.KryoMapper;
-import org.apache.tinkerpop.gremlin.structure.io.kryo.KryoReader;
-import org.apache.tinkerpop.gremlin.structure.io.kryo.KryoWriter;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoMapper;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter;
 import org.apache.tinkerpop.gremlin.structure.strategy.GraphStrategy;
 import org.apache.tinkerpop.gremlin.structure.strategy.SequenceStrategy;
 import org.apache.tinkerpop.gremlin.structure.strategy.StrategyGraph;
@@ -279,53 +279,53 @@ public interface Graph extends AutoCloseable {
      */
     public interface Io {
         /**
-         * Creates a {@link org.apache.tinkerpop.gremlin.structure.io.GraphReader} builder for Kryo serializations. This
-         * method calls the {@link Io#kryoMapper} method to supply to
-         * {@link org.apache.tinkerpop.gremlin.structure.io.kryo.KryoReader.Builder#mapper} which means that implementers
-         * should usually just override {@link Io#kryoMapper} to append in their mapper classes.
+         * Creates a {@link org.apache.tinkerpop.gremlin.structure.io.GraphReader} builder for Gryo serializations. This
+         * method calls the {@link Io#gryoMapper} method to supply to
+         * {@link org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader.Builder#mapper} which means that implementers
+         * should usually just override {@link Io#gryoMapper} to append in their mapper classes.
          */
-        public default KryoReader.Builder kryoReader() {
-            return KryoReader.build().mapper(kryoMapper().create());
+        public default GryoReader.Builder gryoReader() {
+            return GryoReader.build().mapper(gryoMapper().create());
         }
 
         /**
-         * Creates a {@link org.apache.tinkerpop.gremlin.structure.io.GraphWriter} builder for Kryo serializations. This
-         * method calls the {@link Io#kryoMapper} method to supply to
-         * {@link org.apache.tinkerpop.gremlin.structure.io.kryo.KryoWriter.Builder#mapper} which means that implementers
-         * should usually just override {@link Io#kryoMapper} to append in their mapper classes.
+         * Creates a {@link org.apache.tinkerpop.gremlin.structure.io.GraphWriter} builder for Gryo serializations. This
+         * method calls the {@link Io#gryoMapper} method to supply to
+         * {@link org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter.Builder#mapper} which means that implementers
+         * should usually just override {@link Io#gryoMapper} to append in their mapper classes.
          */
-        public default KryoWriter.Builder kryoWriter() {
-            return KryoWriter.build().mapper(kryoMapper().create());
+        public default GryoWriter.Builder gryoWriter() {
+            return GryoWriter.build().mapper(gryoMapper().create());
         }
 
         /**
-         * Write a kryo file using the default configuration of the {@link KryoWriter}.
+         * Write a gryo file using the default configuration of the {@link org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter}.
          */
-        public void writeKryo(final String file) throws IOException;
+        public void writeGryo(final String file) throws IOException;
 
         /**
-         * Read a kryo file using the default configuration of the {@link KryoReader}.
+         * Read a gryo file using the default configuration of the {@link org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader}.
          */
-        public void readKryo(final String file) throws IOException;
+        public void readGryo(final String file) throws IOException;
 
         /**
-         * By default, this method creates an instance of the most current version of {@link org.apache.tinkerpop.gremlin.structure.io.kryo.KryoMapper} which is
+         * By default, this method creates an instance of the most current version of {@link org.apache.tinkerpop.gremlin.structure.io.gryo.GryoMapper} which is
          * used to serialize data to and from the graph.   Implementers with mapper classes (e.g. a non-primitive
          * class returned from {@link Element#id}) should override this method with those classes automatically
-         * registered to the returned {@link org.apache.tinkerpop.gremlin.structure.io.kryo.KryoMapper}.
+         * registered to the returned {@link org.apache.tinkerpop.gremlin.structure.io.gryo.GryoMapper}.
          * <br/>
          * Implementers should respect versions.  Once a class is registered, the order of its registration should be
          * maintained. Note that registering such classes will reduce the portability of the graph data as data
-         * written with {@link org.apache.tinkerpop.gremlin.structure.io.kryo.KryoMapper} will not be readable without this serializer configuration.  It is
+         * written with {@link org.apache.tinkerpop.gremlin.structure.io.gryo.GryoMapper} will not be readable without this serializer configuration.  It is
          * considered good practice to make serialization classes generally available so that users may
-         * register these classes themselves if necessary when building up a mapper {@link org.apache.tinkerpop.gremlin.structure.io.kryo.KryoMapper}
+         * register these classes themselves if necessary when building up a mapper {@link org.apache.tinkerpop.gremlin.structure.io.gryo.GryoMapper}
          * instance.
          * <br/>
          * Note that this method is meant to return current versions for serialization operations.  Users wishing
          * to use an "older" version should construct this instance as well as their readers and writers manually.
          */
-        public default KryoMapper.Builder kryoMapper() {
-            return KryoMapper.build();
+        public default GryoMapper.Builder gryoMapper() {
+            return GryoMapper.build();
         }
 
         /**

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/DefaultIo.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/DefaultIo.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/DefaultIo.java
index cba2e97..7ef6434 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/DefaultIo.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/DefaultIo.java
@@ -39,16 +39,16 @@ public class DefaultIo implements Graph.Io {
     }
 
     @Override
-    public void writeKryo(final String file) throws IOException {
+    public void writeGryo(final String file) throws IOException {
         try (final OutputStream out = new FileOutputStream(file)) {
-            kryoWriter().create().writeGraph(out, g);
+            gryoWriter().create().writeGraph(out, g);
         }
     }
 
     @Override
-    public void readKryo(final String file) throws IOException {
+    public void readGryo(final String file) throws IOException {
         try (final InputStream in = new FileInputStream(file)) {
-            kryoReader().create().readGraph(in, g);
+            gryoReader().create().readGraph(in, g);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphMigrator.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphMigrator.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphMigrator.java
index e7a7c88..618b519 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphMigrator.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/GraphMigrator.java
@@ -19,33 +19,33 @@
 package org.apache.tinkerpop.gremlin.structure.io;
 
 import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.io.kryo.KryoReader;
-import org.apache.tinkerpop.gremlin.structure.io.kryo.KryoWriter;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter;
 
 import java.io.IOException;
 import java.io.PipedInputStream;
 import java.io.PipedOutputStream;
 
 /**
- * {@link GraphMigrator} takes the data in one graph and pipes it to another graph.  Uses the {@link KryoReader}
- * and {@link KryoWriter} by default.
+ * {@link GraphMigrator} takes the data in one graph and pipes it to another graph.  Uses the {@link org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader}
+ * and {@link org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter} by default.
  *
  * @author Alex Averbuch (alex.averbuch@gmail.com)
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public final class GraphMigrator {
 
-    private static final KryoReader defaultKryoReader = KryoReader.build().create();
-    private static final KryoWriter defaultKryoWriter = KryoWriter.build().create();
+    private static final GryoReader DEFAULT_GRYO_READER = GryoReader.build().create();
+    private static final GryoWriter DEFAULT_GRYO_WRITER = GryoWriter.build().create();
 
     /**
-     * Use Kryo to pipe the data from one graph to another graph.  Uses all default settings for reader/writers.
-     * Refer to {@link KryoReader} and {@link KryoWriter} for those settings.  To use features like incremental
+     * Use Gryo to pipe the data from one graph to another graph.  Uses all default settings for reader/writers.
+     * Refer to {@link org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader} and {@link org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter} for those settings.  To use features like incremental
      * loading, construct the reader/writers manually and utilize
      * {@link #migrateGraph(org.apache.tinkerpop.gremlin.structure.Graph, org.apache.tinkerpop.gremlin.structure.Graph, GraphReader, GraphWriter)}
      */
     public static void migrateGraph(final Graph fromGraph, final Graph toGraph) throws IOException {
-        migrateGraph(fromGraph, toGraph, defaultKryoReader, defaultKryoWriter);
+        migrateGraph(fromGraph, toGraph, DEFAULT_GRYO_READER, DEFAULT_GRYO_WRITER);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/EdgeTerminator.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/EdgeTerminator.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/EdgeTerminator.java
new file mode 100644
index 0000000..12848cf
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/EdgeTerminator.java
@@ -0,0 +1,48 @@
+/*
+ * 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.structure.io.gryo;
+
+/**
+ * Represents the end of an edge list in a serialization stream.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+class EdgeTerminator {
+    public static final EdgeTerminator INSTANCE = new EdgeTerminator();
+    private final boolean terminal;
+
+    private EdgeTerminator() {
+        this.terminal = true;
+    }
+
+    @Override
+    public boolean equals(final Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        final EdgeTerminator that = (EdgeTerminator) o;
+
+        return terminal == that.terminal;
+    }
+
+    @Override
+    public int hashCode() {
+        return (terminal ? 1 : 0);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/EntrySerializer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/EntrySerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/EntrySerializer.java
new file mode 100644
index 0000000..c9715bd
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/EntrySerializer.java
@@ -0,0 +1,43 @@
+/*
+ * 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.structure.io.gryo;
+
+import com.esotericsoftware.kryo.Kryo;
+import com.esotericsoftware.kryo.Serializer;
+import com.esotericsoftware.kryo.io.Input;
+import com.esotericsoftware.kryo.io.Output;
+
+import java.util.AbstractMap;
+import java.util.Map;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+class EntrySerializer extends Serializer<Map.Entry> {
+    @Override
+    public void write(final Kryo kryo, final Output output, final Map.Entry entry) {
+        kryo.writeClassAndObject(output, entry.getKey());
+        kryo.writeClassAndObject(output, entry.getValue());
+    }
+
+    @Override
+    public Map.Entry read(final Kryo kryo, final Input input, final Class<Map.Entry> entryClass) {
+        return new AbstractMap.SimpleEntry(kryo.readClassAndObject(input), kryo.readClassAndObject(input));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GraphSerializer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GraphSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GraphSerializer.java
new file mode 100644
index 0000000..aba9f97
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GraphSerializer.java
@@ -0,0 +1,164 @@
+/*
+ * 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.structure.io.gryo;
+
+import com.esotericsoftware.kryo.Kryo;
+import com.esotericsoftware.kryo.Serializer;
+import com.esotericsoftware.kryo.io.Input;
+import com.esotericsoftware.kryo.io.Output;
+import org.apache.tinkerpop.gremlin.process.Path;
+import org.apache.tinkerpop.gremlin.process.Traverser;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Property;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedFactory;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedPath;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedProperty;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertexProperty;
+
+/**
+ * Class used to serialize graph-based objects such as vertices, edges, properties, and paths.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+class GraphSerializer {
+    /**
+     * Serializes any {@link Edge} implementation encountered to a {@link DetachedEdge}.
+     *
+     * @author Stephen Mallette (http://stephen.genoprime.com)
+     */
+    static class EdgeSerializer extends Serializer<Edge> {
+        @Override
+        public void write(final Kryo kryo, final Output output, final Edge edge) {
+            kryo.writeClassAndObject(output, DetachedFactory.detach(edge, true));
+        }
+
+        @Override
+        public Edge read(final Kryo kryo, final Input input, final Class<Edge> edgeClass) {
+            final Object o = kryo.readClassAndObject(input);
+            return (Edge) o;
+        }
+    }
+
+    /**
+     * Serializes any {@link Vertex} implementation encountered to an {@link DetachedVertex}.
+     *
+     * @author Stephen Mallette (http://stephen.genoprime.com)
+     */
+    static class VertexSerializer extends Serializer<Vertex> {
+        public VertexSerializer() {
+        }
+
+        @Override
+        public void write(final Kryo kryo, final Output output, final Vertex vertex) {
+            kryo.writeClassAndObject(output, DetachedFactory.detach(vertex, true));
+        }
+
+        @Override
+        public Vertex read(final Kryo kryo, final Input input, final Class<Vertex> vertexClass) {
+            return (Vertex) kryo.readClassAndObject(input);
+        }
+    }
+
+    /**
+     * Serializes any {@link Property} implementation encountered to an {@link DetachedProperty}.
+     *
+     * @author Stephen Mallette (http://stephen.genoprime.com)
+     */
+    static class PropertySerializer extends Serializer<Property> {
+        public PropertySerializer() {
+        }
+
+        @Override
+        public void write(final Kryo kryo, final Output output, final Property property) {
+            kryo.writeClassAndObject(output, DetachedFactory.detach(property));
+        }
+
+        @Override
+        public Property read(final Kryo kryo, final Input input, final Class<Property> propertyClass) {
+            return (Property) kryo.readClassAndObject(input);
+        }
+    }
+
+    /**
+     * Serializes any {@link VertexProperty} implementation encountered to an {@link DetachedVertexProperty}.
+     *
+     * @author Stephen Mallette (http://stephen.genoprime.com)
+     */
+    static class VertexPropertySerializer extends Serializer<VertexProperty> {
+        public VertexPropertySerializer() {
+        }
+
+        @Override
+        public void write(final Kryo kryo, final Output output, final VertexProperty vertexProperty) {
+            kryo.writeClassAndObject(output, DetachedFactory.detach(vertexProperty, true));
+        }
+
+        @Override
+        public VertexProperty read(final Kryo kryo, final Input input, final Class<VertexProperty> vertexPropertyClass) {
+            return (VertexProperty) kryo.readClassAndObject(input);
+        }
+    }
+
+    /**
+     * Serializes any {@link Path} implementation encountered to an {@link DetachedPath}.
+     *
+     * @author Marko A. Rodriguez (http://markorodriguez.com)
+     */
+    static class PathSerializer extends Serializer<Path> {
+        public PathSerializer() {
+        }
+
+        @Override
+        public void write(final Kryo kryo, final Output output, final Path path) {
+            kryo.writeClassAndObject(output, DetachedFactory.detach(path, false));
+        }
+
+        @Override
+        public Path read(final Kryo kryo, final Input input, final Class<Path> pathClass) {
+            return (Path) kryo.readClassAndObject(input);
+        }
+
+    }
+
+    /**
+     * Serializes any {@link Traverser} implementation encountered via pre-processing with {@link Traverser.Admin#detach()}.
+     *
+     * @author Marko A. Rodriguez (http://markorodriguez.com)
+     */
+    /*static class TraverserSerializer extends Serializer<Traverser.Admin> {
+        public TraverserSerializer() {
+        }
+
+        @Override
+        public void write(final Kryo kryo, final Output output, final Traverser.Admin traverser) {
+            gryo.writeClassAndObject(output, traverser.asAdmin().detach());
+        }
+
+        @Override
+        public Traverser.Admin read(final Kryo kryo, final Input input, final Class<Traverser.Admin> traverser) {
+            return (Traverser.Admin) gryo.readClassAndObject(input);
+        }
+
+    }*/
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GremlinClassResolver.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GremlinClassResolver.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GremlinClassResolver.java
new file mode 100644
index 0000000..449e8b9
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GremlinClassResolver.java
@@ -0,0 +1,206 @@
+/*
+ * 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.structure.io.gryo;
+
+import com.esotericsoftware.kryo.ClassResolver;
+import com.esotericsoftware.kryo.Kryo;
+import com.esotericsoftware.kryo.KryoException;
+import com.esotericsoftware.kryo.Registration;
+import com.esotericsoftware.kryo.io.Input;
+import com.esotericsoftware.kryo.io.Output;
+import com.esotericsoftware.kryo.util.IdentityObjectIntMap;
+import com.esotericsoftware.kryo.util.IntMap;
+import com.esotericsoftware.kryo.util.ObjectMap;
+import org.apache.tinkerpop.gremlin.process.Path;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Property;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedPath;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedProperty;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertexProperty;
+
+import static com.esotericsoftware.kryo.util.Util.getWrapperClass;
+
+/**
+ * This mapper implementation of the {@code ClassResolver} helps ensure that all Vertex and Edge concrete classes
+ * get properly serialized and deserialized by stripping them of their concrete class name so that they are treated
+ * generically.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+class GremlinClassResolver implements ClassResolver {
+    static public final byte NAME = -1;
+
+    protected Kryo kryo;
+
+    protected final IntMap<Registration> idToRegistration = new IntMap<>();
+    protected final ObjectMap<Class, Registration> classToRegistration = new ObjectMap<>();
+
+    protected IdentityObjectIntMap<Class> classToNameId;
+    protected IntMap<Class> nameIdToClass;
+    protected ObjectMap<String, Class> nameToClass;
+    protected int nextNameId;
+
+    private int memoizedClassId = -1;
+    private Registration memoizedClassIdValue;
+    private Class memoizedClass;
+    private Registration memoizedClassValue;
+
+    @Override
+    public void setKryo(Kryo kryo) {
+        this.kryo = kryo;
+    }
+
+    @Override
+    public Registration register(final Registration registration) {
+        if (null == registration) throw new IllegalArgumentException("Registration cannot be null.");
+        if (registration.getId() != NAME) idToRegistration.put(registration.getId(), registration);
+
+        classToRegistration.put(registration.getType(), registration);
+        if (registration.getType().isPrimitive())
+            classToRegistration.put(getWrapperClass(registration.getType()), registration);
+        return registration;
+    }
+
+    @Override
+    public Registration registerImplicit(final Class type) {
+        return register(new Registration(type, kryo.getDefaultSerializer(type), NAME));
+    }
+
+    @Override
+    public Registration getRegistration(final Class clazz) {
+        // force all instances of Vertex, Edge, VertexProperty, etc. to their respective interface
+        final Class type;
+        if (!DetachedVertex.class.isAssignableFrom(clazz) && Vertex.class.isAssignableFrom(clazz))
+            type = Vertex.class;
+        else if (!DetachedEdge.class.isAssignableFrom(clazz) && Edge.class.isAssignableFrom(clazz))
+            type = Edge.class;
+        else if (!DetachedVertexProperty.class.isAssignableFrom(clazz) && VertexProperty.class.isAssignableFrom(clazz))
+            type = VertexProperty.class;
+        else if (!DetachedProperty.class.isAssignableFrom(clazz) && !DetachedVertexProperty.class.isAssignableFrom(clazz) && Property.class.isAssignableFrom(clazz))
+            type = Property.class;
+        else if (!DetachedPath.class.isAssignableFrom(clazz) && Path.class.isAssignableFrom(clazz))
+            type = Path.class;
+        else
+            type = clazz;
+
+        if (type == memoizedClass) return memoizedClassValue;
+        final Registration registration = classToRegistration.get(type);
+        if (registration != null) {
+            memoizedClass = type;
+            memoizedClassValue = registration;
+        }
+
+        return registration;
+    }
+
+    @Override
+    public Registration getRegistration(final int classID) {
+        return idToRegistration.get(classID);
+    }
+
+    @Override
+    public Registration writeClass(final Output output, final Class type) {
+        if (null == type) {
+            output.writeVarInt(Kryo.NULL, true);
+            return null;
+        }
+
+        final Registration registration = kryo.getRegistration(type);
+        if (registration.getId() == NAME)
+            writeName(output, type);
+        else
+            output.writeVarInt(registration.getId() + 2, true);
+
+        return registration;
+    }
+
+    protected void writeName(final Output output, final Class type) {
+        output.writeVarInt(NAME + 2, true);
+        if (classToNameId != null) {
+            final int nameId = classToNameId.get(type, -1);
+            if (nameId != -1) {
+                output.writeVarInt(nameId, true);
+                return;
+            }
+        }
+        // Only write the class name the first time encountered in object graph.
+        final int nameId = nextNameId++;
+        if (classToNameId == null) classToNameId = new IdentityObjectIntMap<>();
+        classToNameId.put(type, nameId);
+        output.writeVarInt(nameId, true);
+        output.writeString(type.getName());
+    }
+
+    @Override
+    public Registration readClass(final Input input) {
+        final int classID = input.readVarInt(true);
+        switch (classID) {
+            case Kryo.NULL:
+                return null;
+            case NAME + 2: // Offset for NAME and NULL.
+                return readName(input);
+        }
+
+        if (classID == memoizedClassId) return memoizedClassIdValue;
+        final Registration registration = idToRegistration.get(classID - 2);
+        if (registration == null) throw new KryoException("Encountered unregistered class ID: " + (classID - 2));
+        memoizedClassId = classID;
+        memoizedClassIdValue = registration;
+        return registration;
+    }
+
+    protected Registration readName(final Input input) {
+        final int nameId = input.readVarInt(true);
+        if (nameIdToClass == null) nameIdToClass = new IntMap<>();
+        Class type = nameIdToClass.get(nameId);
+        if (type == null) {
+            // Only read the class name the first time encountered in object graph.
+            final String className = input.readString();
+            type = getTypeByName(className);
+            if (type == null) {
+                try {
+                    type = Class.forName(className, false, kryo.getClassLoader());
+                } catch (ClassNotFoundException ex) {
+                    throw new KryoException("Unable to find class: " + className, ex);
+                }
+                if (nameToClass == null) nameToClass = new ObjectMap<>();
+                nameToClass.put(className, type);
+            }
+            nameIdToClass.put(nameId, type);
+        }
+        return kryo.getRegistration(type);
+    }
+
+    protected Class<?> getTypeByName(final String className) {
+        return nameToClass != null ? nameToClass.get(className) : null;
+    }
+
+    @Override
+    public void reset() {
+        if (!kryo.isRegistrationRequired()) {
+            if (classToNameId != null) classToNameId.clear();
+            if (nameIdToClass != null) nameIdToClass.clear();
+            nextNameId = 0;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
new file mode 100644
index 0000000..511891e
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
@@ -0,0 +1,406 @@
+/*
+ * 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.structure.io.gryo;
+
+import com.esotericsoftware.kryo.Kryo;
+import com.esotericsoftware.kryo.KryoSerializable;
+import com.esotericsoftware.kryo.Serializer;
+import com.esotericsoftware.kryo.io.Input;
+import com.esotericsoftware.kryo.io.Output;
+import com.esotericsoftware.kryo.util.DefaultStreamFactory;
+import com.esotericsoftware.kryo.util.MapReferenceResolver;
+import org.apache.tinkerpop.gremlin.process.Path;
+import org.apache.tinkerpop.gremlin.process.T;
+import org.apache.tinkerpop.gremlin.process.computer.MapReduce;
+import org.apache.tinkerpop.gremlin.process.computer.util.MapMemory;
+import org.apache.tinkerpop.gremlin.process.graph.util.Tree;
+import org.apache.tinkerpop.gremlin.process.traverser.B_O_PA_S_SE_SL_Traverser;
+import org.apache.tinkerpop.gremlin.process.traverser.B_O_P_PA_S_SE_SL_Traverser;
+import org.apache.tinkerpop.gremlin.process.traverser.B_O_Traverser;
+import org.apache.tinkerpop.gremlin.process.traverser.O_Traverser;
+import org.apache.tinkerpop.gremlin.process.util.BulkSet;
+import org.apache.tinkerpop.gremlin.process.util.metric.DependantMutableMetrics;
+import org.apache.tinkerpop.gremlin.process.util.metric.MutableMetrics;
+import org.apache.tinkerpop.gremlin.process.util.metric.StandardTraversalMetrics;
+import org.apache.tinkerpop.gremlin.process.util.TraverserSet;
+import org.apache.tinkerpop.gremlin.structure.Contains;
+import org.apache.tinkerpop.gremlin.structure.Direction;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Property;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+import org.apache.tinkerpop.gremlin.structure.io.Mapper;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedPath;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedProperty;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertexProperty;
+import org.javatuples.Triplet;
+
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URI;
+import java.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.function.BiPredicate;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
+
+/**
+ * A {@link Mapper} implementation for Kryo.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public final class GryoMapper implements Mapper<Kryo> {
+    static final byte[] GIO = "gio".getBytes();
+    private final List<Triplet<Class, Function<Kryo, Serializer>, Integer>> serializationList;
+    private final HeaderWriter headerWriter;
+    private final HeaderReader headerReader;
+    private final byte[] versionedHeader;
+
+    public static final byte DEFAULT_EXTENDED_VERSION = Byte.MIN_VALUE;
+
+    private GryoMapper(final List<Triplet<Class, Function<Kryo, Serializer>, Integer>> serializationList,
+                       final HeaderWriter headerWriter,
+                       final HeaderReader headerReader) {
+        this.serializationList = serializationList;
+        this.headerWriter = headerWriter;
+        this.headerReader = headerReader;
+
+        final Output out = new Output(32);
+        try {
+            this.headerWriter.write(createMapper(), out);
+        } catch (IOException ioe) {
+            throw new RuntimeException(ioe);
+        }
+        this.versionedHeader = out.toBytes();
+    }
+
+    @Override
+    public Kryo createMapper() {
+        final Kryo kryo = new Kryo(new GremlinClassResolver(), new MapReferenceResolver(), new DefaultStreamFactory());
+        kryo.addDefaultSerializer(Map.Entry.class, new EntrySerializer());
+        kryo.setRegistrationRequired(true);
+        serializationList.forEach(p -> {
+            final Function<Kryo, Serializer> serializer = p.getValue1();
+            if (null == serializer)
+                kryo.register(p.getValue0(), kryo.getDefaultSerializer(p.getValue0()), p.getValue2());
+            else
+                kryo.register(p.getValue0(), serializer.apply(kryo), p.getValue2());
+        });
+        return kryo;
+    }
+
+    public HeaderWriter getHeaderWriter() {
+        return headerWriter;
+    }
+
+    public HeaderReader getHeaderReader() {
+        return headerReader;
+    }
+
+    /**
+     * Gets the header for a Gremlin Kryo file, which is based on the version of Gremlin Kryo that is constructed
+     * via the builder classes.
+     */
+    public byte[] getVersionedHeader() {
+        return versionedHeader;
+    }
+
+    @FunctionalInterface
+    public interface HeaderReader {
+        public void read(final Kryo kryo, final Input input) throws IOException;
+    }
+
+    @FunctionalInterface
+    public interface HeaderWriter {
+        public void write(final Kryo kryo, final Output output) throws IOException;
+    }
+
+    /**
+     * Use a specific version of Gryo.
+     */
+    public static Builder build(final Version version) {
+        return version.getBuilder();
+    }
+
+    /**
+     * Use the most current version of Gryo.
+     */
+    public static Builder build() {
+        return Version.V_1_0_0.getBuilder();
+    }
+
+    public static interface Builder {
+        /**
+         * Add mapper classes to serializes with gryo using standard serialization.
+         */
+        public Builder addCustom(final Class... custom);
+
+        /**
+         * Add mapper class to serializes with mapper serialization.
+         */
+        public Builder addCustom(final Class clazz, final Serializer serializer);
+
+        /**
+         * Add mapper class to serializes with mapper serialization as returned from a {@link Function}.
+         */
+        public Builder addCustom(final Class clazz, final Function<Kryo, Serializer> serializer);
+
+        /**
+         * If using mapper classes it might be useful to tag the version stamped to the serialization with a mapper
+         * value, such that Gryo serialization at 1.0.0 would have a fourth byte for an extended version.  The user
+         * supplied fourth byte can then be used to ensure the right deserializer is used to read the data. If this
+         * value is not supplied then it is written as {@link Byte#MIN_VALUE}. The value supplied here should be greater
+         * than or equal to zero.
+         */
+        public Builder extendedVersion(final byte extendedVersion);
+
+        /**
+         * By default the {@link #extendedVersion(byte)} is checked against what is read from an input source and if
+         * those values are equal the version being read is considered "compliant".  To alter this behavior, supply a
+         * mapper compliance {@link Predicate} to evaluate the value read from the input source (i.e. first argument)
+         * and the value marked in the {@code GryoMapper} instance {i.e. second argument}.  Supplying this function is
+         * useful when versions require backward compatibility or other more complex checks.  This function is only used
+         * if the {@link #extendedVersion(byte)} is set to something other than its default.
+         */
+        public Builder compliant(final BiPredicate<Byte, Byte> compliant);
+
+        public GryoMapper create();
+    }
+
+    public enum Version {
+        V_1_0_0(BuilderV1d0.class);
+
+        private final Class<? extends Builder> builder;
+
+        private Version(final Class<? extends Builder> builder) {
+            this.builder = builder;
+        }
+
+        Builder getBuilder() {
+            try {
+                return builder.newInstance();
+            } catch (Exception x) {
+                throw new RuntimeException("Gryo Builder implementation cannot be instantiated", x);
+            }
+        }
+    }
+
+    public static class BuilderV1d0 implements Builder {
+
+        /**
+         * Map with one entry that is used so that it is possible to get the class of LinkedHashMap.Entry.
+         */
+        private static final LinkedHashMap m = new LinkedHashMap() {{
+            put("junk", "dummy");
+        }};
+
+        private static final Class LINKED_HASH_MAP_ENTRY_CLASS = m.entrySet().iterator().next().getClass();
+
+        /**
+         * Note that the following are pre-registered boolean, Boolean, byte, Byte, char, Character, double, Double,
+         * int, Integer, float, Float, long, Long, short, Short, String, void.
+         */
+        private final List<Triplet<Class, Function<Kryo, Serializer>, Integer>> serializationList = new ArrayList<Triplet<Class, Function<Kryo, Serializer>, Integer>>() {{
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(byte[].class, null, 25));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(char[].class, null, 26));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(short[].class, null, 27));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(int[].class, null, 28));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(long[].class, null, 29));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(float[].class, null, 30));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(double[].class, null, 31));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(String[].class, null, 32));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Object[].class, null, 33));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(ArrayList.class, null, 10));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(BigInteger.class, null, 34));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(BigDecimal.class, null, 35));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Calendar.class, null, 39));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Class.class, null, 41));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Collection.class, null, 37));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Collections.EMPTY_LIST.getClass(), null, 51));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Collections.EMPTY_MAP.getClass(), null, 52));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Collections.EMPTY_SET.getClass(), null, 53));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Collections.singleton(null).getClass(), null, 54));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Collections.singletonList(null).getClass(), null, 24));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Collections.singletonMap(null, null).getClass(), null, 23));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Contains.class, null, 49));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Currency.class, null, 40));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Date.class, null, 38));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Direction.class, null, 12));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(DetachedEdge.class, null, 21));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(DetachedVertexProperty.class, null, 20));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(DetachedProperty.class, null, 18));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(DetachedVertex.class, null, 19));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(DetachedPath.class, null, 60));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(EdgeTerminator.class, null, 14));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(EnumSet.class, null, 46));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(HashMap.class, null, 11));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(HashMap.Entry.class, null, 16));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(KryoSerializable.class, null, 36));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(LinkedHashMap.class, null, 47));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(LinkedHashSet.class, null, 71));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(LINKED_HASH_MAP_ENTRY_CLASS, null, 15));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Locale.class, null, 22));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(StringBuffer.class, null, 43));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(StringBuilder.class, null, 44));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(T.class, null, 48));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(TimeZone.class, null, 42));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(TreeMap.class, null, 45));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(TreeSet.class, null, 50));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(UUID.class, kryo -> new UUIDSerializer(), 17));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(URI.class, kryo -> new URISerializer(), 72));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(VertexTerminator.class, null, 13));
+
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Edge.class, kryo -> new GraphSerializer.EdgeSerializer(), 65));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Vertex.class, kryo -> new GraphSerializer.VertexSerializer(), 66));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Property.class, kryo -> new GraphSerializer.PropertySerializer(), 67));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(VertexProperty.class, kryo -> new GraphSerializer.VertexPropertySerializer(), 68));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Path.class, kryo -> new GraphSerializer.PathSerializer(), 59));
+            // HACK!
+            //add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Traverser.Admin.class, gryo -> new GraphSerializer.TraverserSerializer(), 55));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(B_O_Traverser.class, null, 75));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(O_Traverser.class, null, 76));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(B_O_P_PA_S_SE_SL_Traverser.class, null, 77));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(B_O_PA_S_SE_SL_Traverser.class, null, 78));
+
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(TraverserSet.class, null, 58));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Tree.class, null, 61));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(HashSet.class, null, 62));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(BulkSet.class, null, 64));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(MutableMetrics.class, null, 69));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(StandardTraversalMetrics.class, null, 70));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(MapMemory.class, null, 73));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(MapReduce.NullObject.class, null, 74));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(AtomicLong.class, null, 79));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(DependantMutableMetrics.class, null, 80));  // ***LAST ID**
+        }};
+
+        private static final byte major = 1;
+        private static final byte minor = 0;
+        private static final byte patchLevel = 0;
+
+        private byte extendedVersion = DEFAULT_EXTENDED_VERSION;
+        private BiPredicate<Byte, Byte> compliant = (readExt, serExt) -> readExt.equals(serExt);
+
+        /**
+         * Starts numbering classes for Gryo serialization at 65536 to leave room for future usage by TinkerPop.
+         */
+        private final AtomicInteger currentSerializationId = new AtomicInteger(65536);
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public Builder addCustom(final Class... custom) {
+            if (custom != null && custom.length > 0)
+                serializationList.addAll(Arrays.asList(custom).stream()
+                        .map(c -> Triplet.<Class, Function<Kryo, Serializer>, Integer>with(c, null, currentSerializationId.getAndIncrement()))
+                        .collect(Collectors.<Triplet<Class, Function<Kryo, Serializer>, Integer>>toList()));
+            return this;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public Builder addCustom(final Class clazz, final Serializer serializer) {
+            serializationList.add(Triplet.with(clazz, kryo -> serializer, currentSerializationId.getAndIncrement()));
+            return this;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public Builder addCustom(final Class clazz, final Function<Kryo, Serializer> serializer) {
+            serializationList.add(Triplet.with(clazz, serializer, currentSerializationId.getAndIncrement()));
+            return this;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public Builder extendedVersion(final byte extendedVersion) {
+            if (extendedVersion > DEFAULT_EXTENDED_VERSION && extendedVersion < 0)
+                throw new IllegalArgumentException("The extendedVersion must be greater than zero");
+
+            this.extendedVersion = extendedVersion;
+            return this;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public Builder compliant(final BiPredicate<Byte, Byte> compliant) {
+            if (null == compliant)
+                throw new IllegalArgumentException("compliant");
+
+            this.compliant = compliant;
+            return this;
+        }
+
+        @Override
+        public GryoMapper create() {
+            return new GryoMapper(serializationList, this::writeHeader, this::readHeader);
+        }
+
+        private void writeHeader(final Kryo kryo, final Output output) throws IOException {
+            // 32 byte header total
+            output.writeBytes(GIO);
+
+            // some space for later
+            output.writeBytes(new byte[25]);
+
+            // version x.y.z
+            output.writeByte(major);
+            output.writeByte(minor);
+            output.writeByte(patchLevel);
+            output.writeByte(extendedVersion);
+        }
+
+        private void readHeader(final Kryo kryo, final Input input) throws IOException {
+            if (!Arrays.equals(GIO, input.readBytes(3)))
+                throw new IOException("Invalid format - first three bytes of header do not match expected value");
+
+            // skip the next 25 bytes in v1
+            input.readBytes(25);
+
+            // final three bytes of header are the version which should be 1.0.0
+            final byte[] version = input.readBytes(3);
+            final byte extension = input.readByte();
+
+            // direct match on version for now
+            if (version[0] != major || version[1] != minor || version[2] != patchLevel)
+                throw new IOException(String.format(
+                        "The version [%s.%s.%s] in the stream cannot be understood by this reader",
+                        version[0], version[1], version[2]));
+
+            if (extendedVersion >= 0 && !compliant.test(extension, extendedVersion))
+                throw new IOException(String.format(
+                        "The extension [%s] in the input source is not compliant with this configuration of Gryo - [%s]",
+                        extension, extendedVersion));
+        }
+    }
+}


[3/8] incubator-tinkerpop git commit: Renamed Gremlin Kryo to simply Gryo.

Posted by ok...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java
index ae4746a..2b6f728 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java
@@ -28,8 +28,7 @@ import org.apache.tinkerpop.gremlin.LoadGraphWith;
 import org.apache.tinkerpop.gremlin.process.Path;
 import org.apache.tinkerpop.gremlin.process.util.metric.TraversalMetrics;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONTokens;
-import org.apache.tinkerpop.gremlin.structure.io.kryo.KryoMapper;
-import org.junit.Ignore;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoMapper;
 import org.junit.Test;
 import org.junit.experimental.runners.Enclosed;
 import org.junit.runner.RunWith;
@@ -54,8 +53,8 @@ public class SerializationTest {
         @Test
         @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
         public void shouldSerializeVertexAsDetached() throws Exception {
-            final KryoMapper kryoMapper = g.io().kryoMapper().create();
-            final Kryo kryo = kryoMapper.createMapper();
+            final GryoMapper gryoMapper = g.io().gryoMapper().create();
+            final Kryo kryo = gryoMapper.createMapper();
             final Vertex v = g.V(convertToVertexId("marko")).next();
             final ByteArrayOutputStream stream = new ByteArrayOutputStream();
             final Output output = new Output(stream);
@@ -75,8 +74,8 @@ public class SerializationTest {
         @Test
         @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
         public void shouldSerializeEdgeAsDetached() throws Exception {
-            final KryoMapper kryoMapper = g.io().kryoMapper().create();
-            final Kryo kryo = kryoMapper.createMapper();
+            final GryoMapper gryoMapper = g.io().gryoMapper().create();
+            final Kryo kryo = gryoMapper.createMapper();
             final Edge e = g.E(convertToEdgeId("marko", "knows", "vadas")).next();
             final ByteArrayOutputStream stream = new ByteArrayOutputStream();
             final Output output = new Output(stream);
@@ -94,8 +93,8 @@ public class SerializationTest {
         @Test
         @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
         public void shouldSerializePropertyAsDetached() throws Exception {
-            final KryoMapper kryoMapper = g.io().kryoMapper().create();
-            final Kryo kryo = kryoMapper.createMapper();
+            final GryoMapper gryoMapper = g.io().gryoMapper().create();
+            final Kryo kryo = gryoMapper.createMapper();
             final Property p = g.E(convertToEdgeId("marko", "knows", "vadas")).next().property("weight");
             final ByteArrayOutputStream stream = new ByteArrayOutputStream();
             final Output output = new Output(stream);
@@ -112,8 +111,8 @@ public class SerializationTest {
         @Test
         @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
         public void shouldSerializeVertexPropertyAsDetached() throws Exception {
-            final KryoMapper kryoMapper = g.io().kryoMapper().create();
-            final Kryo kryo = kryoMapper.createMapper();
+            final GryoMapper gryoMapper = g.io().gryoMapper().create();
+            final Kryo kryo = gryoMapper.createMapper();
             final VertexProperty vp = g.V(convertToVertexId("marko")).next().property("name");
             final ByteArrayOutputStream stream = new ByteArrayOutputStream();
             final Output output = new Output(stream);
@@ -132,8 +131,8 @@ public class SerializationTest {
         @Test
         @LoadGraphWith(LoadGraphWith.GraphData.CREW)
         public void shouldSerializeVertexPropertyWithPropertiesAsDetached() throws Exception {
-            final KryoMapper kryoMapper = g.io().kryoMapper().create();
-            final Kryo kryo = kryoMapper.createMapper();
+            final GryoMapper gryoMapper = g.io().gryoMapper().create();
+            final Kryo kryo = gryoMapper.createMapper();
             final VertexProperty vp = g.V(convertToVertexId("marko")).next().iterators().propertyIterator("location").next();
             final ByteArrayOutputStream stream = new ByteArrayOutputStream();
             final Output output = new Output(stream);
@@ -156,8 +155,8 @@ public class SerializationTest {
         @Test
         @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
         public void shouldSerializePathAsDetached() throws Exception {
-            final KryoMapper kryoMapper = g.io().kryoMapper().create();
-            final Kryo kryo = kryoMapper.createMapper();
+            final GryoMapper gryoMapper = g.io().gryoMapper().create();
+            final Kryo kryo = gryoMapper.createMapper();
             final Path p = g.V(convertToVertexId("marko")).as("a").outE().as("b").inV().as("c").path()
                     .filter(t -> ((Vertex) t.get().objects().get(2)).value("name").equals("lop")).next();
             final ByteArrayOutputStream stream = new ByteArrayOutputStream();

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoResourceAccess.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoResourceAccess.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoResourceAccess.java
new file mode 100644
index 0000000..905da9b
--- /dev/null
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoResourceAccess.java
@@ -0,0 +1,27 @@
+/*
+ * 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.structure.io.gryo;
+
+/**
+ * Provides path access to test data resources.
+ *
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public class GryoResourceAccess {
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/KryoResourceAccess.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/KryoResourceAccess.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/KryoResourceAccess.java
deleted file mode 100644
index 8e25b28..0000000
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/KryoResourceAccess.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.structure.io.kryo;
-
-/**
- * Provides path access to test data resources.
- *
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class KryoResourceAccess {
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/grateful-dead-vertices.kryo
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/grateful-dead-vertices.kryo b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/grateful-dead-vertices.kryo
new file mode 100644
index 0000000..2031c24
Binary files /dev/null and b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/grateful-dead-vertices.kryo differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/grateful-dead.kryo
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/grateful-dead.kryo b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/grateful-dead.kryo
new file mode 100644
index 0000000..97143b1
Binary files /dev/null and b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/grateful-dead.kryo differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-classic-vertices.kryo
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-classic-vertices.kryo b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-classic-vertices.kryo
new file mode 100644
index 0000000..33f8766
Binary files /dev/null and b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-classic-vertices.kryo differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-classic.kryo
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-classic.kryo b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-classic.kryo
new file mode 100644
index 0000000..e2f72c6
Binary files /dev/null and b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-classic.kryo differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-crew-vertices.kryo
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-crew-vertices.kryo b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-crew-vertices.kryo
new file mode 100644
index 0000000..8289cd8
Binary files /dev/null and b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-crew-vertices.kryo differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-crew.kryo
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-crew.kryo b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-crew.kryo
new file mode 100644
index 0000000..3e8ac2d
Binary files /dev/null and b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-crew.kryo differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-modern-vertices.kryo
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-modern-vertices.kryo b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-modern-vertices.kryo
new file mode 100644
index 0000000..760e4d4
Binary files /dev/null and b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-modern-vertices.kryo differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-modern.kryo
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-modern.kryo b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-modern.kryo
new file mode 100644
index 0000000..05e6101
Binary files /dev/null and b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/tinkerpop-modern.kryo differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/grateful-dead-vertices.gio
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/grateful-dead-vertices.gio b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/grateful-dead-vertices.gio
deleted file mode 100644
index 2031c24..0000000
Binary files a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/grateful-dead-vertices.gio and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/grateful-dead.gio
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/grateful-dead.gio b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/grateful-dead.gio
deleted file mode 100644
index 97143b1..0000000
Binary files a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/grateful-dead.gio and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/tinkerpop-classic-vertices.gio
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/tinkerpop-classic-vertices.gio b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/tinkerpop-classic-vertices.gio
deleted file mode 100644
index 33f8766..0000000
Binary files a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/tinkerpop-classic-vertices.gio and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/tinkerpop-classic.gio
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/tinkerpop-classic.gio b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/tinkerpop-classic.gio
deleted file mode 100644
index e2f72c6..0000000
Binary files a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/tinkerpop-classic.gio and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/tinkerpop-crew-vertices.gio
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/tinkerpop-crew-vertices.gio b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/tinkerpop-crew-vertices.gio
deleted file mode 100644
index 8289cd8..0000000
Binary files a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/tinkerpop-crew-vertices.gio and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/tinkerpop-crew.gio
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/tinkerpop-crew.gio b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/tinkerpop-crew.gio
deleted file mode 100644
index 3e8ac2d..0000000
Binary files a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/tinkerpop-crew.gio and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/tinkerpop-modern-vertices.gio
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/tinkerpop-modern-vertices.gio b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/tinkerpop-modern-vertices.gio
deleted file mode 100644
index 760e4d4..0000000
Binary files a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/tinkerpop-modern-vertices.gio and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/tinkerpop-modern.gio
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/tinkerpop-modern.gio b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/tinkerpop-modern.gio
deleted file mode 100644
index 05e6101..0000000
Binary files a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/kryo/tinkerpop-modern.gio and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapperTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapperTest.java b/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapperTest.java
new file mode 100644
index 0000000..21bc5bc
--- /dev/null
+++ b/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapperTest.java
@@ -0,0 +1,34 @@
+/*
+ * 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.structure.io.gryo;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertNotSame;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class GryoMapperTest {
+    @Test
+    public void shouldGetMostRecentVersion() {
+        final GryoMapper.Builder b = GryoMapper.build();
+        assertNotSame(b, GryoMapper.build());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/structure/io/kryo/KryoMapperTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/structure/io/kryo/KryoMapperTest.java b/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/structure/io/kryo/KryoMapperTest.java
deleted file mode 100644
index 4c9e742..0000000
--- a/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/structure/io/kryo/KryoMapperTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.structure.io.kryo;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertNotSame;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class KryoMapperTest {
-    @Test
-    public void shouldGetMostRecentVersion() {
-        final KryoMapper.Builder b = KryoMapper.build();
-        assertNotSame(b, KryoMapper.build());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/hadoop-gremlin/conf/hadoop-gryo.properties
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/conf/hadoop-gryo.properties b/hadoop-gremlin/conf/hadoop-gryo.properties
new file mode 100644
index 0000000..7813ad7
--- /dev/null
+++ b/hadoop-gremlin/conf/hadoop-gryo.properties
@@ -0,0 +1,31 @@
+# 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.
+gremlin.graph=org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph
+gremlin.hadoop.graphInputFormat=org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoInputFormat
+gremlin.hadoop.graphOutputFormat=org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoOutputFormat
+gremlin.hadoop.memoryOutputFormat=org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat
+gremlin.hadoop.deriveMemory=false
+gremlin.hadoop.jarsInDistributedCache=true
+
+gremlin.hadoop.inputLocation=tinkerpop-modern-vertices.kryo
+gremlin.hadoop.outputLocation=output
+#gremlin.vertexProgram=org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalVertexProgram
+#gremlin.traversalVertexProgram.traversalSupplier.type=CLASS
+#gremlin.traversalVertexProgram.traversalSupplier.object=org.apache.tinkerpop.gremlin.hadoop.process.computer.example.TraversalSupplier1
+
+giraph.minWorkers=2
+giraph.maxWorkers=2
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/hadoop-gremlin/conf/hadoop-kryo.properties
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/conf/hadoop-kryo.properties b/hadoop-gremlin/conf/hadoop-kryo.properties
deleted file mode 100644
index d546da7..0000000
--- a/hadoop-gremlin/conf/hadoop-kryo.properties
+++ /dev/null
@@ -1,31 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#  http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-gremlin.graph=org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph
-gremlin.hadoop.graphInputFormat=org.apache.tinkerpop.gremlin.hadoop.structure.io.kryo.KryoInputFormat
-gremlin.hadoop.graphOutputFormat=org.apache.tinkerpop.gremlin.hadoop.structure.io.kryo.KryoOutputFormat
-gremlin.hadoop.memoryOutputFormat=org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat
-gremlin.hadoop.deriveMemory=false
-gremlin.hadoop.jarsInDistributedCache=true
-
-gremlin.hadoop.inputLocation=tinkerpop-modern-vertices.gio
-gremlin.hadoop.outputLocation=output
-#gremlin.vertexProgram=org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalVertexProgram
-#gremlin.traversalVertexProgram.traversalSupplier.type=CLASS
-#gremlin.traversalVertexProgram.traversalSupplier.object=org.apache.tinkerpop.gremlin.hadoop.process.computer.example.TraversalSupplier1
-
-giraph.minWorkers=2
-giraph.maxWorkers=2
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/groovy/plugin/HadoopGremlinPlugin.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/groovy/plugin/HadoopGremlinPlugin.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/groovy/plugin/HadoopGremlinPlugin.java
index 2609ddf..c91d445 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/groovy/plugin/HadoopGremlinPlugin.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/groovy/plugin/HadoopGremlinPlugin.java
@@ -35,7 +35,7 @@ import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph;
 import org.apache.tinkerpop.gremlin.hadoop.structure.hdfs.HDFSTools;
 import org.apache.tinkerpop.gremlin.hadoop.structure.io.VertexWritable;
 import org.apache.tinkerpop.gremlin.hadoop.structure.io.graphson.GraphSONInputFormat;
-import org.apache.tinkerpop.gremlin.hadoop.structure.io.kryo.KryoInputFormat;
+import org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoInputFormat;
 import org.apache.tinkerpop.gremlin.hadoop.structure.io.script.ScriptInputFormat;
 import org.apache.tinkerpop.gremlin.hadoop.structure.util.ConfUtil;
 
@@ -62,7 +62,7 @@ public class HadoopGremlinPlugin extends AbstractGremlinPlugin {
         add(IMPORT_SPACE + HadoopConfiguration.class.getPackage().getName() + DOT_STAR);
         add(IMPORT_SPACE + ConfUtil.class.getPackage().getName() + DOT_STAR);
         add(IMPORT_SPACE + VertexWritable.class.getPackage().getName() + DOT_STAR);
-        add(IMPORT_SPACE + KryoInputFormat.class.getPackage().getName() + DOT_STAR);
+        add(IMPORT_SPACE + GryoInputFormat.class.getPackage().getName() + DOT_STAR);
         add(IMPORT_SPACE + GraphSONInputFormat.class.getPackage().getName() + DOT_STAR);
         add(IMPORT_SPACE + ScriptInputFormat.class.getPackage().getName() + DOT_STAR);
         add(IMPORT_SPACE + HDFSTools.class.getPackage().getName() + DOT_STAR);

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/giraph/GiraphComputeVertex.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/giraph/GiraphComputeVertex.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/giraph/GiraphComputeVertex.java
index f392c4c..00e1adf 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/giraph/GiraphComputeVertex.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/giraph/GiraphComputeVertex.java
@@ -27,8 +27,8 @@ import org.apache.tinkerpop.gremlin.structure.Direction;
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
-import org.apache.tinkerpop.gremlin.structure.io.kryo.KryoReader;
-import org.apache.tinkerpop.gremlin.structure.io.kryo.KryoWriter;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter;
 import org.apache.tinkerpop.gremlin.structure.strategy.StrategyVertex;
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge;
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
@@ -57,8 +57,8 @@ public final class GiraphComputeVertex extends Vertex<LongWritable, Text, NullWr
     private static final String VERTEX_ID = Graph.Hidden.hide("giraph.gremlin.vertexId");
     private TinkerVertex tinkerVertex;
     private StrategyVertex wrappedVertex;
-    private static KryoWriter KRYO_WRITER = KryoWriter.build().create();
-    private static KryoReader KRYO_READER = KryoReader.build().create();
+    private static GryoWriter KRYO_WRITER = GryoWriter.build().create();
+    private static GryoReader KRYO_READER = GryoReader.build().create();
 
     public GiraphComputeVertex() {
     }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/giraph/RuleWritable.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/giraph/RuleWritable.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/giraph/RuleWritable.java
index d69edaf..ed309e7 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/giraph/RuleWritable.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/giraph/RuleWritable.java
@@ -78,7 +78,7 @@ public class RuleWritable implements Writable {
             bytes[i] = input.readByte();
         }
         final Input in = new Input(new ByteArrayInputStream(bytes));
-        this.object = Constants.KRYO.readClassAndObject(in);
+        this.object = Constants.GRYO.readClassAndObject(in);
         in.close();*/
     }
 
@@ -92,7 +92,7 @@ public class RuleWritable implements Writable {
         /*
         final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
         final Output out = new Output(outputStream);
-        Constants.KRYO.writeClassAndObject(out, this.object);
+        Constants.GRYO.writeClassAndObject(out, this.object);
         out.flush();
         WritableUtils.writeVInt(output, this.rule.ordinal());
         WritableUtils.writeVInt(output, outputStream.toByteArray().length);

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/ObjectWritable.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/ObjectWritable.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/ObjectWritable.java
index 55a78a0..1d5cd69 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/ObjectWritable.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/ObjectWritable.java
@@ -60,7 +60,7 @@ public final class ObjectWritable<T> implements WritableComparable<ObjectWritabl
         } catch (final ClassNotFoundException e) {
             throw new IOException(e.getMessage(), e);
         }
-        //this.t = (T) Constants.KRYO.readClassAndObject(new Input(new ByteArrayInputStream(WritableUtils.readCompressedByteArray(input))));
+        //this.t = (T) Constants.GRYO.readClassAndObject(new Input(new ByteArrayInputStream(WritableUtils.readCompressedByteArray(input))));
     }
 
     @Override
@@ -68,7 +68,7 @@ public final class ObjectWritable<T> implements WritableComparable<ObjectWritabl
         WritableUtils.writeCompressedByteArray(output, Serializer.serializeObject(this.t));
         /*final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
         final Output out = new Output(outputStream);
-        Constants.KRYO.writeClassAndObject(out, this.t);
+        Constants.GRYO.writeClassAndObject(out, this.t);
         out.flush();
         WritableUtils.writeCompressedByteArray(output, outputStream.toByteArray());
         out.close();*/

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/VertexWritable.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/VertexWritable.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/VertexWritable.java
index 09d26ce..a42060c 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/VertexWritable.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/VertexWritable.java
@@ -21,8 +21,8 @@ package org.apache.tinkerpop.gremlin.hadoop.structure.io;
 import org.apache.tinkerpop.gremlin.structure.Direction;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.structure.io.kryo.KryoReader;
-import org.apache.tinkerpop.gremlin.structure.io.kryo.KryoWriter;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter;
 import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge;
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
@@ -42,8 +42,8 @@ import java.io.IOException;
 public final class VertexWritable<V extends Vertex> implements Writable {
 
     private Vertex vertex;
-    private static final KryoWriter KRYO_WRITER = KryoWriter.build().create();
-    private static final KryoReader KRYO_READER = KryoReader.build().create();
+    private static final GryoWriter KRYO_WRITER = GryoWriter.build().create();
+    private static final GryoReader KRYO_READER = GryoReader.build().create();
 
     public VertexWritable(final Vertex vertex) {
         this.vertex = vertex;

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoInputFormat.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoInputFormat.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoInputFormat.java
new file mode 100644
index 0000000..1fc2ecd
--- /dev/null
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoInputFormat.java
@@ -0,0 +1,63 @@
+/*
+ * 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.hadoop.structure.io.gryo;
+
+import org.apache.tinkerpop.gremlin.hadoop.structure.io.VertexWritable;
+import org.apache.hadoop.conf.Configurable;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.io.NullWritable;
+import org.apache.hadoop.io.compress.CompressionCodecFactory;
+import org.apache.hadoop.mapreduce.InputSplit;
+import org.apache.hadoop.mapreduce.JobContext;
+import org.apache.hadoop.mapreduce.RecordReader;
+import org.apache.hadoop.mapreduce.TaskAttemptContext;
+import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
+
+import java.io.IOException;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public class GryoInputFormat extends FileInputFormat<NullWritable, VertexWritable> implements Configurable {
+
+    private Configuration config;
+
+    @Override
+    public RecordReader<NullWritable, VertexWritable> createRecordReader(final InputSplit split, final TaskAttemptContext context) throws IOException, InterruptedException {
+        final RecordReader<NullWritable, VertexWritable> reader = new GryoRecordReader();
+        reader.initialize(split, context);
+        return reader;
+    }
+
+    @Override
+    protected boolean isSplitable(final JobContext context, final Path file) {
+        return null == new CompressionCodecFactory(context.getConfiguration()).getCodec(file);
+    }
+
+    @Override
+    public void setConf(final Configuration config) {
+        this.config = config;
+    }
+
+    @Override
+    public Configuration getConf() {
+        return this.config;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoOutputFormat.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoOutputFormat.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoOutputFormat.java
new file mode 100644
index 0000000..7a214f8
--- /dev/null
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoOutputFormat.java
@@ -0,0 +1,43 @@
+/*
+ * 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.hadoop.structure.io.gryo;
+
+import org.apache.tinkerpop.gremlin.hadoop.structure.io.CommonFileOutputFormat;
+import org.apache.tinkerpop.gremlin.hadoop.structure.io.VertexWritable;
+import org.apache.hadoop.io.NullWritable;
+import org.apache.hadoop.mapreduce.RecordWriter;
+import org.apache.hadoop.mapreduce.TaskAttemptContext;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public class GryoOutputFormat extends CommonFileOutputFormat {
+
+    @Override
+    public RecordWriter<NullWritable, VertexWritable> getRecordWriter(final TaskAttemptContext job) throws IOException, InterruptedException {
+        return new GryoRecordWriter(getDataOuputStream(job));
+    }
+
+    public RecordWriter<NullWritable, VertexWritable> getRecordWriter(final TaskAttemptContext job, final DataOutputStream outputStream) throws IOException, InterruptedException {
+        return new GryoRecordWriter(outputStream);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordReader.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordReader.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordReader.java
new file mode 100644
index 0000000..d120a6f
--- /dev/null
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordReader.java
@@ -0,0 +1,113 @@
+/*
+ * 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.hadoop.structure.io.gryo;
+
+import org.apache.tinkerpop.gremlin.hadoop.structure.io.VertexWritable;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoMapper;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FSDataInputStream;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.io.NullWritable;
+import org.apache.hadoop.io.compress.CompressionCodecFactory;
+import org.apache.hadoop.mapreduce.InputSplit;
+import org.apache.hadoop.mapreduce.RecordReader;
+import org.apache.hadoop.mapreduce.TaskAttemptContext;
+import org.apache.hadoop.mapreduce.lib.input.FileSplit;
+
+import java.io.IOException;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public class GryoRecordReader extends RecordReader<NullWritable, VertexWritable> {
+
+    private VertexStreamIterator vertexStreamIterator;
+    private FSDataInputStream inputStream;
+
+    private static final byte[] PATTERN = GryoMapper.build().create().getVersionedHeader();
+
+    public GryoRecordReader() {
+    }
+
+    @Override
+    public void initialize(final InputSplit genericSplit, final TaskAttemptContext context) throws IOException {
+        final FileSplit split = (FileSplit) genericSplit;
+        final Configuration job = context.getConfiguration();
+        long start = split.getStart();
+        final Path file = split.getPath();
+        if (null != new CompressionCodecFactory(job).getCodec(file)) {
+            throw new IllegalStateException("Compression is not supported for the (binary) Gryo format");
+        }
+        // open the file and seek to the start of the split
+        this.inputStream = file.getFileSystem(job).open(split.getPath());
+        this.inputStream.seek(start);
+        final long newStart = seekToHeader(this.inputStream, start);
+        this.vertexStreamIterator = new VertexStreamIterator(this.inputStream, split.getLength() - (newStart - start));
+    }
+
+    private static long seekToHeader(final FSDataInputStream inputStream, final long start) throws IOException {
+        long nextStart = start;
+        final byte[] buffer = new byte[32];
+        while (true) {
+            if ((buffer[0] = PATTERN[0]) == inputStream.readByte()) {
+                inputStream.read(nextStart + 1, buffer, 1, 31);
+                if (patternMatch(buffer)) {
+                    inputStream.seek(nextStart);
+                    return nextStart;
+                }
+            } else {
+                nextStart = nextStart + 1;
+                inputStream.seek(nextStart);
+            }
+        }
+    }
+
+    private static boolean patternMatch(final byte[] bytes) {
+        for (int i = 0; i < 31; i++) {
+            if (bytes[i] != PATTERN[i])
+                return false;
+        }
+        return true;
+    }
+
+    @Override
+    public boolean nextKeyValue() throws IOException {
+        return this.vertexStreamIterator.hasNext();
+    }
+
+    @Override
+    public NullWritable getCurrentKey() {
+        return NullWritable.get();
+    }
+
+    @Override
+    public VertexWritable getCurrentValue() {
+        return this.vertexStreamIterator.next();
+    }
+
+    @Override
+    public float getProgress() throws IOException {
+        return this.vertexStreamIterator.getProgress();
+    }
+
+    @Override
+    public synchronized void close() throws IOException {
+        this.inputStream.close();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordWriter.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordWriter.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordWriter.java
new file mode 100644
index 0000000..9af8597
--- /dev/null
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordWriter.java
@@ -0,0 +1,54 @@
+/*
+ * 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.hadoop.structure.io.gryo;
+
+import org.apache.tinkerpop.gremlin.hadoop.structure.io.VertexWritable;
+import org.apache.tinkerpop.gremlin.structure.Direction;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter;
+import org.apache.hadoop.io.NullWritable;
+import org.apache.hadoop.mapreduce.RecordWriter;
+import org.apache.hadoop.mapreduce.TaskAttemptContext;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public class GryoRecordWriter extends RecordWriter<NullWritable, VertexWritable> {
+
+    private final DataOutputStream out;
+    private static final GryoWriter GRYO_WRITER = GryoWriter.build().create();
+
+    public GryoRecordWriter(final DataOutputStream out) {
+        this.out = out;
+    }
+
+    @Override
+    public void write(final NullWritable key, final VertexWritable vertex) throws IOException {
+        if (null != vertex) {
+            GRYO_WRITER.writeVertex(out, vertex.get(), Direction.BOTH);
+        }
+    }
+
+    @Override
+    public synchronized void close(TaskAttemptContext context) throws IOException {
+        this.out.close();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/VertexStreamIterator.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/VertexStreamIterator.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/VertexStreamIterator.java
new file mode 100644
index 0000000..b32a944
--- /dev/null
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/VertexStreamIterator.java
@@ -0,0 +1,147 @@
+/*
+ * 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.hadoop.structure.io.gryo;
+
+import org.apache.tinkerpop.gremlin.hadoop.structure.io.VertexWritable;
+import org.apache.tinkerpop.gremlin.structure.Direction;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Iterator;
+import java.util.function.Function;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public class VertexStreamIterator implements Iterator<VertexWritable> {
+
+    // this is VertexTerminator's long terminal 4185403236219066774L as an array of positive int's
+    private static final int[] TERMINATOR = new int[]{58, 21, 138, 17, 112, 155, 153, 150};
+
+    private static int BUFLEN = TERMINATOR.length;
+
+    private final InputStream inputStream;
+    private static final GryoReader GRYO_READER = GryoReader.build().create();
+    private final ByteArrayOutputStream output = new ByteArrayOutputStream();
+    private final int[] buffer = new int[BUFLEN];
+
+    private int len;
+    private int currentByte;
+    private Vertex currentVertex;
+    private final long maxLength;
+    private long currentLength = 0;
+
+    public VertexStreamIterator(final InputStream inputStream, final long maxLength) {
+        this.inputStream = inputStream;
+        this.maxLength = maxLength;
+    }
+
+    public float getProgress() {
+        if (0 == this.currentLength || 0 == this.maxLength)
+            return 0.0f;
+        else if (this.currentLength >= this.maxLength || this.maxLength == Long.MAX_VALUE)
+            return 1.0f;
+        else
+            return (float) this.currentLength / (float) this.maxLength;
+
+    }
+
+    @Override
+    public boolean hasNext() {
+        if (this.currentLength >= this.maxLength) // gone beyond the split boundary
+            return false;
+        if (null != this.currentVertex)
+            return true;
+        else if (-1 == this.currentByte)
+            return false;
+        else {
+            try {
+                this.currentVertex = advanceToNextVertex();
+                return null != this.currentVertex;
+            } catch (final IOException e) {
+                throw new IllegalStateException(e.getMessage(), e);
+            }
+        }
+    }
+
+    @Override
+    public VertexWritable next() {
+        try {
+            if (null == this.currentVertex) {
+                if (this.hasNext())
+                    return new VertexWritable(this.currentVertex);
+                else
+                    throw new IllegalStateException("There are no more vertices in this split");
+            } else
+                return new VertexWritable(this.currentVertex);
+        } finally {
+            this.currentVertex = null;
+            this.len = 0;
+            this.output.reset();
+        }
+    }
+
+    private final Vertex advanceToNextVertex() throws IOException {
+        while (true) {
+            this.currentByte = this.inputStream.read();
+            this.currentLength++;
+            if (-1 == this.currentByte) {
+                if (this.len > 0) {
+                    throw new IllegalStateException("Remainder of stream exhausted without matching a vertex");
+                } else {
+                    return null;
+                }
+            }
+
+            if (this.len >= BUFLEN)
+                this.output.write(this.buffer[this.len % BUFLEN]);
+
+            this.buffer[this.len % BUFLEN] = this.currentByte;
+            this.len++;
+
+            if (this.len > BUFLEN) {
+                boolean terminated = true;
+                for (int i = 0; i < BUFLEN; i++) {
+                    if (this.buffer[(this.len + i) % BUFLEN] != TERMINATOR[i]) {
+                        terminated = false;
+                        break;
+                    }
+                }
+
+                if (terminated) {
+                    final Graph gLocal = TinkerGraph.open();
+                    final Function<DetachedVertex, Vertex> vertexMaker = detachedVertex -> DetachedVertex.addTo(gLocal, detachedVertex);
+                    final Function<DetachedEdge, Edge> edgeMaker = detachedEdge -> DetachedEdge.addTo(gLocal, detachedEdge);
+                    try (InputStream in = new ByteArrayInputStream(this.output.toByteArray())) {
+                        return GRYO_READER.readVertex(in, Direction.BOTH, vertexMaker, edgeMaker);
+                    }
+                }
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/kryo/KryoInputFormat.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/kryo/KryoInputFormat.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/kryo/KryoInputFormat.java
deleted file mode 100644
index cad79f6..0000000
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/kryo/KryoInputFormat.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.hadoop.structure.io.kryo;
-
-import org.apache.tinkerpop.gremlin.hadoop.structure.io.VertexWritable;
-import org.apache.hadoop.conf.Configurable;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.io.NullWritable;
-import org.apache.hadoop.io.compress.CompressionCodecFactory;
-import org.apache.hadoop.mapreduce.InputSplit;
-import org.apache.hadoop.mapreduce.JobContext;
-import org.apache.hadoop.mapreduce.RecordReader;
-import org.apache.hadoop.mapreduce.TaskAttemptContext;
-import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
-
-import java.io.IOException;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class KryoInputFormat extends FileInputFormat<NullWritable, VertexWritable> implements Configurable {
-
-    private Configuration config;
-
-    @Override
-    public RecordReader<NullWritable, VertexWritable> createRecordReader(final InputSplit split, final TaskAttemptContext context) throws IOException, InterruptedException {
-        RecordReader<NullWritable, VertexWritable> reader = new KryoRecordReader();
-        reader.initialize(split, context);
-        return reader;
-    }
-
-    @Override
-    protected boolean isSplitable(final JobContext context, final Path file) {
-        return null == new CompressionCodecFactory(context.getConfiguration()).getCodec(file);
-    }
-
-    @Override
-    public void setConf(final Configuration config) {
-        this.config = config;
-    }
-
-    @Override
-    public Configuration getConf() {
-        return this.config;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/kryo/KryoOutputFormat.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/kryo/KryoOutputFormat.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/kryo/KryoOutputFormat.java
deleted file mode 100644
index 8b26a7c..0000000
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/kryo/KryoOutputFormat.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.hadoop.structure.io.kryo;
-
-import org.apache.tinkerpop.gremlin.hadoop.structure.io.CommonFileOutputFormat;
-import org.apache.tinkerpop.gremlin.hadoop.structure.io.VertexWritable;
-import org.apache.hadoop.io.NullWritable;
-import org.apache.hadoop.mapreduce.RecordWriter;
-import org.apache.hadoop.mapreduce.TaskAttemptContext;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class KryoOutputFormat extends CommonFileOutputFormat {
-
-    @Override
-    public RecordWriter<NullWritable, VertexWritable> getRecordWriter(final TaskAttemptContext job) throws IOException, InterruptedException {
-        return new KryoRecordWriter(getDataOuputStream(job));
-    }
-
-    public RecordWriter<NullWritable, VertexWritable> getRecordWriter(final TaskAttemptContext job, final DataOutputStream outputStream) throws IOException, InterruptedException {
-        return new KryoRecordWriter(outputStream);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/kryo/KryoRecordReader.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/kryo/KryoRecordReader.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/kryo/KryoRecordReader.java
deleted file mode 100644
index 7ed405d..0000000
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/kryo/KryoRecordReader.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.hadoop.structure.io.kryo;
-
-import org.apache.tinkerpop.gremlin.hadoop.structure.io.VertexWritable;
-import org.apache.tinkerpop.gremlin.structure.io.kryo.KryoMapper;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FSDataInputStream;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.io.NullWritable;
-import org.apache.hadoop.io.compress.CompressionCodecFactory;
-import org.apache.hadoop.mapreduce.InputSplit;
-import org.apache.hadoop.mapreduce.RecordReader;
-import org.apache.hadoop.mapreduce.TaskAttemptContext;
-import org.apache.hadoop.mapreduce.lib.input.FileSplit;
-
-import java.io.IOException;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class KryoRecordReader extends RecordReader<NullWritable, VertexWritable> {
-
-    private VertexStreamIterator vertexStreamIterator;
-    private FSDataInputStream inputStream;
-
-    private static final byte[] PATTERN = KryoMapper.build().create().getVersionedHeader();
-
-    public KryoRecordReader() {
-    }
-
-    @Override
-    public void initialize(final InputSplit genericSplit, final TaskAttemptContext context) throws IOException {
-        final FileSplit split = (FileSplit) genericSplit;
-        final Configuration job = context.getConfiguration();
-        long start = split.getStart();
-        final Path file = split.getPath();
-        if (null != new CompressionCodecFactory(job).getCodec(file)) {
-            throw new IllegalStateException("Compression is not supported for the (binary) Gremlin Kryo format");
-        }
-        // open the file and seek to the start of the split
-        this.inputStream = file.getFileSystem(job).open(split.getPath());
-        this.inputStream.seek(start);
-        final long newStart = seekToHeader(this.inputStream, start);
-        this.vertexStreamIterator = new VertexStreamIterator(this.inputStream, split.getLength() - (newStart - start));
-    }
-
-    private static long seekToHeader(final FSDataInputStream inputStream, final long start) throws IOException {
-        long nextStart = start;
-        final byte[] buffer = new byte[32];
-        while (true) {
-            if ((buffer[0] = PATTERN[0]) == inputStream.readByte()) {
-                inputStream.read(nextStart + 1, buffer, 1, 31);
-                if (patternMatch(buffer)) {
-                    inputStream.seek(nextStart);
-                    return nextStart;
-                }
-            } else {
-                nextStart = nextStart + 1;
-                inputStream.seek(nextStart);
-            }
-        }
-    }
-
-    private static boolean patternMatch(final byte[] bytes) {
-        for (int i = 0; i < 31; i++) {
-            if (bytes[i] != PATTERN[i])
-                return false;
-        }
-        return true;
-    }
-
-    @Override
-    public boolean nextKeyValue() throws IOException {
-        return this.vertexStreamIterator.hasNext();
-    }
-
-    @Override
-    public NullWritable getCurrentKey() {
-        return NullWritable.get();
-    }
-
-    @Override
-    public VertexWritable getCurrentValue() {
-        return this.vertexStreamIterator.next();
-    }
-
-    @Override
-    public float getProgress() throws IOException {
-        return this.vertexStreamIterator.getProgress();
-    }
-
-    @Override
-    public synchronized void close() throws IOException {
-        this.inputStream.close();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/kryo/KryoRecordWriter.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/kryo/KryoRecordWriter.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/kryo/KryoRecordWriter.java
deleted file mode 100644
index c9d1b8f..0000000
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/kryo/KryoRecordWriter.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.hadoop.structure.io.kryo;
-
-import org.apache.tinkerpop.gremlin.hadoop.structure.io.VertexWritable;
-import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.apache.tinkerpop.gremlin.structure.io.kryo.KryoWriter;
-import org.apache.hadoop.io.NullWritable;
-import org.apache.hadoop.mapreduce.RecordWriter;
-import org.apache.hadoop.mapreduce.TaskAttemptContext;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class KryoRecordWriter extends RecordWriter<NullWritable, VertexWritable> {
-
-    private final DataOutputStream out;
-    private static final KryoWriter KRYO_WRITER = KryoWriter.build().create();
-
-    public KryoRecordWriter(final DataOutputStream out) {
-        this.out = out;
-    }
-
-    @Override
-    public void write(final NullWritable key, final VertexWritable vertex) throws IOException {
-        if (null != vertex) {
-            KRYO_WRITER.writeVertex(out, vertex.get(), Direction.BOTH);
-        }
-    }
-
-    @Override
-    public synchronized void close(TaskAttemptContext context) throws IOException {
-        this.out.close();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/kryo/VertexStreamIterator.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/kryo/VertexStreamIterator.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/kryo/VertexStreamIterator.java
deleted file mode 100644
index 6784d92..0000000
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/kryo/VertexStreamIterator.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.hadoop.structure.io.kryo;
-
-import org.apache.tinkerpop.gremlin.hadoop.structure.io.VertexWritable;
-import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.structure.io.kryo.KryoReader;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
-import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Iterator;
-import java.util.function.Function;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class VertexStreamIterator implements Iterator<VertexWritable> {
-
-    // this is VertexTerminator's long terminal 4185403236219066774L as an array of positive int's
-    private static final int[] TERMINATOR = new int[]{58, 21, 138, 17, 112, 155, 153, 150};
-
-    private static int BUFLEN = TERMINATOR.length;
-
-    private final InputStream inputStream;
-    private static final KryoReader KRYO_READER = KryoReader.build().create();
-    private final ByteArrayOutputStream output = new ByteArrayOutputStream();
-    private final int[] buffer = new int[BUFLEN];
-
-    private int len;
-    private int currentByte;
-    private Vertex currentVertex;
-    private final long maxLength;
-    private long currentLength = 0;
-
-    public VertexStreamIterator(final InputStream inputStream, final long maxLength) {
-        this.inputStream = inputStream;
-        this.maxLength = maxLength;
-    }
-
-    public float getProgress() {
-        if (0 == this.currentLength || 0 == this.maxLength)
-            return 0.0f;
-        else if (this.currentLength >= this.maxLength || this.maxLength == Long.MAX_VALUE)
-            return 1.0f;
-        else
-            return (float) this.currentLength / (float) this.maxLength;
-
-    }
-
-    @Override
-    public boolean hasNext() {
-        if (this.currentLength >= this.maxLength) // gone beyond the split boundary
-            return false;
-        if (null != this.currentVertex)
-            return true;
-        else if (-1 == this.currentByte)
-            return false;
-        else {
-            try {
-                this.currentVertex = advanceToNextVertex();
-                return null != this.currentVertex;
-            } catch (final IOException e) {
-                throw new IllegalStateException(e.getMessage(), e);
-            }
-        }
-    }
-
-    @Override
-    public VertexWritable next() {
-        try {
-            if (null == this.currentVertex) {
-                if (this.hasNext())
-                    return new VertexWritable(this.currentVertex);
-                else
-                    throw new IllegalStateException("There are no more vertices in this split");
-            } else
-                return new VertexWritable(this.currentVertex);
-        } finally {
-            this.currentVertex = null;
-            this.len = 0;
-            this.output.reset();
-        }
-    }
-
-    private final Vertex advanceToNextVertex() throws IOException {
-        while (true) {
-            this.currentByte = this.inputStream.read();
-            this.currentLength++;
-            if (-1 == this.currentByte) {
-                if (this.len > 0) {
-                    throw new IllegalStateException("Remainder of stream exhausted without matching a vertex");
-                } else {
-                    return null;
-                }
-            }
-
-            if (this.len >= BUFLEN)
-                this.output.write(this.buffer[this.len % BUFLEN]);
-
-            this.buffer[this.len % BUFLEN] = this.currentByte;
-            this.len++;
-
-            if (this.len > BUFLEN) {
-                boolean terminated = true;
-                for (int i = 0; i < BUFLEN; i++) {
-                    if (this.buffer[(this.len + i) % BUFLEN] != TERMINATOR[i]) {
-                        terminated = false;
-                        break;
-                    }
-                }
-
-                if (terminated) {
-                    final Graph gLocal = TinkerGraph.open();
-                    final Function<DetachedVertex, Vertex> vertexMaker = detachedVertex -> DetachedVertex.addTo(gLocal, detachedVertex);
-                    final Function<DetachedEdge, Edge> edgeMaker = detachedEdge -> DetachedEdge.addTo(gLocal, detachedEdge);
-                    try (InputStream in = new ByteArrayInputStream(this.output.toByteArray())) {
-                        return KRYO_READER.readVertex(in, Direction.BOTH, vertexMaker, edgeMaker);
-                    }
-                }
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/HadoopGraphProvider.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/HadoopGraphProvider.java b/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/HadoopGraphProvider.java
index 7153d8f..300def1 100644
--- a/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/HadoopGraphProvider.java
+++ b/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/HadoopGraphProvider.java
@@ -32,11 +32,11 @@ import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraphVariables;
 import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopProperty;
 import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopVertex;
 import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopVertexProperty;
-import org.apache.tinkerpop.gremlin.hadoop.structure.io.kryo.KryoInputFormat;
-import org.apache.tinkerpop.gremlin.hadoop.structure.io.kryo.KryoOutputFormat;
+import org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoInputFormat;
+import org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoOutputFormat;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONResourceAccess;
-import org.apache.tinkerpop.gremlin.structure.io.kryo.KryoResourceAccess;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoResourceAccess;
 import org.apache.tinkerpop.gremlin.structure.io.script.ScriptResourceAccess;
 
 import java.util.Arrays;
@@ -67,12 +67,12 @@ public class HadoopGraphProvider extends AbstractGraphProvider {
     static {
         try {
             final List<String> kryoResources = Arrays.asList(
-                    "tinkerpop-modern-vertices.gio",
-                    "grateful-dead-vertices.gio",
-                    "tinkerpop-classic-vertices.gio",
-                    "tinkerpop-crew-vertices.gio");
+                    "tinkerpop-modern-vertices.kryo",
+                    "grateful-dead-vertices.kryo",
+                    "tinkerpop-classic-vertices.kryo",
+                    "tinkerpop-crew-vertices.kryo");
             for (final String fileName : kryoResources) {
-                PATHS.put(fileName, TestHelper.generateTempFileFromResource(KryoResourceAccess.class, fileName, "").getAbsolutePath());
+                PATHS.put(fileName, TestHelper.generateTempFileFromResource(GryoResourceAccess.class, fileName, "").getAbsolutePath());
             }
 
             final List<String> graphsonResources = Arrays.asList(
@@ -97,8 +97,8 @@ public class HadoopGraphProvider extends AbstractGraphProvider {
     public Map<String, Object> getBaseConfiguration(final String graphName, final Class<?> test, final String testMethodName) {
         return new HashMap<String, Object>() {{
             put("gremlin.graph", HadoopGraph.class.getName());
-            put(Constants.GREMLIN_HADOOP_GRAPH_INPUT_FORMAT, KryoInputFormat.class.getCanonicalName());
-            put(Constants.GREMLIN_HADOOP_GRAPH_OUTPUT_FORMAT, KryoOutputFormat.class.getCanonicalName());
+            put(Constants.GREMLIN_HADOOP_GRAPH_INPUT_FORMAT, GryoInputFormat.class.getCanonicalName());
+            put(Constants.GREMLIN_HADOOP_GRAPH_OUTPUT_FORMAT, GryoOutputFormat.class.getCanonicalName());
             //put(Constants.GREMLIN_GIRAPH_MEMORY_OUTPUT_FORMAT_CLASS, TextOutputFormat.class.getCanonicalName());
             put(Constants.GREMLIN_HADOOP_MEMORY_OUTPUT_FORMAT, SequenceFileOutputFormat.class.getCanonicalName());
             put(GiraphConstants.MIN_WORKERS, 1);
@@ -109,7 +109,7 @@ public class HadoopGraphProvider extends AbstractGraphProvider {
             put("giraph.zkServerPort", "2181");  // you must have a local zookeeper running on this port
             put("giraph.nettyServerUseExecutionHandler", false); // this prevents so many integration tests running out of threads
             put("giraph.nettyClientUseExecutionHandler", false); // this prevents so many integration tests running out of threads
-            //put(Constants.GREMLIN_GIRAPH_INPUT_LOCATION, KryoInputFormat.class.getResource("tinkerpop-classic-vertices.gio").getPath());
+            //put(Constants.GREMLIN_GIRAPH_INPUT_LOCATION, GryoInputFormat.class.getResource("tinkerpop-classic-vertices.kryo").getPath());
             put(Constants.GREMLIN_HADOOP_OUTPUT_LOCATION, "hadoop-gremlin/target/test-output");
             put(Constants.GREMLIN_HADOOP_DERIVE_MEMORY, true);
             put(Constants.GREMLIN_HADOOP_JARS_IN_DISTRIBUTED_CACHE, false);
@@ -135,13 +135,13 @@ public class HadoopGraphProvider extends AbstractGraphProvider {
     public void loadGraphDataViaHadoopConfig(final Graph g, final LoadGraphWith.GraphData graphData) {
 
         if (graphData.equals(LoadGraphWith.GraphData.GRATEFUL)) {
-            ((HadoopGraph) g).configuration().setInputLocation(PATHS.get("grateful-dead-vertices.gio"));
+            ((HadoopGraph) g).configuration().setInputLocation(PATHS.get("grateful-dead-vertices.kryo"));
         } else if (graphData.equals(LoadGraphWith.GraphData.MODERN)) {
-            ((HadoopGraph) g).configuration().setInputLocation(PATHS.get("tinkerpop-modern-vertices.gio"));
+            ((HadoopGraph) g).configuration().setInputLocation(PATHS.get("tinkerpop-modern-vertices.kryo"));
         } else if (graphData.equals(LoadGraphWith.GraphData.CLASSIC)) {
-            ((HadoopGraph) g).configuration().setInputLocation(PATHS.get("tinkerpop-classic-vertices.gio"));
+            ((HadoopGraph) g).configuration().setInputLocation(PATHS.get("tinkerpop-classic-vertices.kryo"));
         } else if (graphData.equals(LoadGraphWith.GraphData.CREW)) {
-            ((HadoopGraph) g).configuration().setInputLocation(PATHS.get("tinkerpop-crew-vertices.gio"));
+            ((HadoopGraph) g).configuration().setInputLocation(PATHS.get("tinkerpop-crew-vertices.kryo"));
         } else {
             throw new RuntimeException("Could not load graph with " + graphData);
         }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/graphson/VertexStreamIteratorTest.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/graphson/VertexStreamIteratorTest.java b/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/graphson/VertexStreamIteratorTest.java
index 138e4a0..1cedfd9 100644
--- a/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/graphson/VertexStreamIteratorTest.java
+++ b/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/graphson/VertexStreamIteratorTest.java
@@ -18,11 +18,11 @@
  */
 package org.apache.tinkerpop.gremlin.hadoop.structure.io.graphson;
 
-import org.apache.tinkerpop.gremlin.hadoop.structure.io.kryo.VertexStreamIterator;
+import org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.VertexStreamIterator;
 import org.apache.tinkerpop.gremlin.structure.Direction;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.structure.io.kryo.KryoWriter;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory;
 import org.junit.Test;
 
@@ -42,7 +42,7 @@ public class VertexStreamIteratorTest {
         Graph g = TinkerFactory.createClassic();
 
         try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            final KryoWriter writer = KryoWriter.build().create();
+            final GryoWriter writer = GryoWriter.build().create();
             writer.writeVertices(os, g.V(), Direction.BOTH);
             final AtomicInteger called = new AtomicInteger(0);
             VertexStreamIterator vsi = new VertexStreamIterator(new ByteArrayInputStream(os.toByteArray()), Long.MAX_VALUE);


[6/8] incubator-tinkerpop git commit: Renamed Gremlin Kryo to simply Gryo.

Posted by ok...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java
new file mode 100644
index 0000000..164758d
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java
@@ -0,0 +1,400 @@
+/*
+ * 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.structure.io.gryo;
+
+import com.esotericsoftware.kryo.Kryo;
+import com.esotericsoftware.kryo.io.Input;
+import com.esotericsoftware.kryo.io.Output;
+import org.apache.tinkerpop.gremlin.process.T;
+import org.apache.tinkerpop.gremlin.structure.*;
+import org.apache.tinkerpop.gremlin.structure.io.GraphReader;
+import org.apache.tinkerpop.gremlin.structure.util.batch.BatchGraph;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
+
+import java.io.*;
+import java.util.*;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.function.Function;
+
+/**
+ * The {@link GraphReader} for the Gremlin Structure serialization format based on Kryo.  The format is meant to be
+ * non-lossy in terms of Gremlin Structure to Gremlin Structure migrations (assuming both structure implementations
+ * support the same graph features).
+ * <br/>
+ * This implementation is not thread-safe.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public class GryoReader implements GraphReader {
+    private final Kryo kryo;
+    private final GryoMapper.HeaderReader headerReader;
+
+    private final long batchSize;
+    private final String vertexIdKey;
+    private final String edgeIdKey;
+
+    private final File tempFile;
+
+    final AtomicLong counter = new AtomicLong(0);
+
+    private GryoReader(final File tempFile, final long batchSize,
+                       final String vertexIdKey, final String edgeIdKey,
+                       final GryoMapper gryoMapper) {
+        this.kryo = gryoMapper.createMapper();
+        this.headerReader = gryoMapper.getHeaderReader();
+        this.vertexIdKey = vertexIdKey;
+        this.edgeIdKey = edgeIdKey;
+        this.tempFile = tempFile;
+        this.batchSize = batchSize;
+    }
+
+    @Override
+    public Iterator<Vertex> readVertices(final InputStream inputStream, final Direction direction,
+                                         final Function<DetachedVertex, Vertex> vertexMaker,
+                                         final Function<DetachedEdge, Edge> edgeMaker) throws IOException {
+        final Input input = new Input(inputStream);
+        return new Iterator<Vertex>() {
+            @Override
+            public boolean hasNext() {
+                return !input.eof();
+            }
+
+            @Override
+            public Vertex next() {
+                try {
+                    final Vertex v = readVertex(direction, vertexMaker, edgeMaker, input);
+
+                    // read the vertex terminator
+                    kryo.readClassAndObject(input);
+
+                    return v;
+                } catch (Exception ex) {
+                    throw new RuntimeException(ex);
+                }
+            }
+        };
+    }
+
+    @Override
+    public Edge readEdge(final InputStream inputStream, final Function<DetachedEdge, Edge> edgeMaker) throws IOException {
+        final Input input = new Input(inputStream);
+        this.headerReader.read(kryo, input);
+        final Object o = kryo.readClassAndObject(input);
+        return edgeMaker.apply((DetachedEdge) o);
+    }
+
+    @Override
+    public Vertex readVertex(final InputStream inputStream, final Function<DetachedVertex, Vertex> vertexMaker) throws IOException {
+        return readVertex(inputStream, null, vertexMaker, null);
+    }
+
+    @Override
+    public Vertex readVertex(final InputStream inputStream, final Direction direction, Function<DetachedVertex, Vertex> vertexMaker, final Function<DetachedEdge, Edge> edgeMaker) throws IOException {
+        final Input input = new Input(inputStream);
+        return readVertex(direction, vertexMaker, edgeMaker, input);
+    }
+
+    @Override
+    public void readGraph(final InputStream inputStream, final Graph graphToWriteTo) throws IOException {
+        this.counter.set(0);
+        final Input input = new Input(inputStream);
+        this.headerReader.read(kryo, input);
+
+        final BatchGraph graph;
+        try {
+            // will throw an exception if not constructed properly
+            graph = BatchGraph.build(graphToWriteTo)
+                    .vertexIdKey(vertexIdKey)
+                    .edgeIdKey(edgeIdKey)
+                    .bufferSize(batchSize).create();
+        } catch (Exception ex) {
+            throw new IOException("Could not instantiate BatchGraph wrapper", ex);
+        }
+
+        try (final Output output = new Output(new FileOutputStream(tempFile))) {
+            final boolean supportedMemory = input.readBoolean();
+            if (supportedMemory) {
+                // if the graph that serialized the data supported sideEffects then the sideEffects needs to be read
+                // to advance the reader forward.  if the graph being read into doesn't support the sideEffects
+                // then we just setting the data to sideEffects.
+                final Map<String, Object> memMap = (Map<String, Object>) kryo.readObject(input, HashMap.class);
+                if (graphToWriteTo.features().graph().variables().supportsVariables()) {
+                    final Graph.Variables variables = graphToWriteTo.variables();
+                    memMap.forEach(variables::set);
+                }
+            }
+
+            final boolean hasSomeVertices = input.readBoolean();
+            if (hasSomeVertices) {
+                final List<Object> vertexArgs = new ArrayList<>();
+                while (!input.eof()) {
+                    final DetachedVertex current = (DetachedVertex) kryo.readClassAndObject(input);
+                    appendToArgList(vertexArgs, T.id, current.id());
+                    appendToArgList(vertexArgs, T.label, current.label());
+
+                    final Vertex v = graph.addVertex(vertexArgs.toArray());
+                    vertexArgs.clear();
+                    current.iterators().propertyIterator().forEachRemaining(p -> createVertexProperty(graphToWriteTo, v, p, false));
+
+                    // the gio file should have been written with a direction specified
+                    final boolean hasDirectionSpecified = input.readBoolean();
+                    final Direction directionInStream = kryo.readObject(input, Direction.class);
+                    final Direction directionOfEdgeBatch = kryo.readObject(input, Direction.class);
+
+                    // graph serialization requires that a direction be specified in the stream and that the
+                    // direction of the edges be OUT
+                    if (!hasDirectionSpecified || directionInStream != Direction.OUT || directionOfEdgeBatch != Direction.OUT)
+                        throw new IllegalStateException(String.format("Stream must specify edge direction and that direction must be %s", Direction.OUT));
+
+                    // if there are edges then read them to end and write to temp, otherwise read what should be
+                    // the vertex terminator
+                    if (!input.readBoolean())
+                        kryo.readClassAndObject(input);
+                    else
+                        readToEndOfEdgesAndWriteToTemp(input, output);
+                }
+            }
+        } catch (Exception ex) {
+            throw new IOException(ex);
+        }
+        // done writing to temp
+
+        // start reading in the edges now from the temp file
+        try (final Input edgeInput = new Input(new FileInputStream(tempFile))) {
+            readFromTempEdges(edgeInput, graph);
+            graph.tx().commit();
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            throw new IOException(ex);
+        } finally {
+            deleteTempFileSilently();
+        }
+    }
+
+    private static void createVertexProperty(final Graph graphToWriteTo, final Vertex v, final VertexProperty<Object> p, final boolean hidden) {
+        final List<Object> propertyArgs = new ArrayList<>();
+        if (graphToWriteTo.features().vertex().properties().supportsUserSuppliedIds())
+            appendToArgList(propertyArgs, T.id, p.id());
+        p.iterators().propertyIterator().forEachRemaining(it -> appendToArgList(propertyArgs, it.key(), it.value()));
+        v.property(p.key(), p.value(), propertyArgs.toArray());
+    }
+
+    private static void appendToArgList(final List<Object> propertyArgs, final Object key, final Object val) {
+        propertyArgs.add(key);
+        propertyArgs.add(val);
+    }
+
+    private Vertex readVertex(final Direction directionRequested, final Function<DetachedVertex, Vertex> vertexMaker,
+                              final Function<DetachedEdge, Edge> edgeMaker, final Input input) throws IOException {
+        if (null != directionRequested && null == edgeMaker)
+            throw new IllegalArgumentException("If a directionRequested is specified then an edgeAdder function should also be specified");
+
+        this.headerReader.read(kryo, input);
+
+        final DetachedVertex detachedVertex = (DetachedVertex) kryo.readClassAndObject(input);
+        final Vertex v = vertexMaker.apply(detachedVertex);
+
+        final boolean streamContainsEdgesInSomeDirection = input.readBoolean();
+        if (!streamContainsEdgesInSomeDirection && directionRequested != null)
+            throw new IllegalStateException(String.format("The direction %s was requested but no attempt was made to serialize edges into this stream", directionRequested));
+
+        // if there are edges in the stream and the direction is not present then the rest of the stream is
+        // simply ignored
+        if (directionRequested != null) {
+            final Direction directionsInStream = kryo.readObject(input, Direction.class);
+            if (directionsInStream != Direction.BOTH && directionsInStream != directionRequested)
+                throw new IllegalStateException(String.format("Stream contains %s edges, but requesting %s", directionsInStream, directionRequested));
+
+            final Direction firstDirection = kryo.readObject(input, Direction.class);
+            if (firstDirection == Direction.OUT && (directionRequested == Direction.BOTH || directionRequested == Direction.OUT))
+                readEdges(input, edgeMaker);
+            else {
+                // requested direction in, but BOTH must be serialized so skip this.  the illegalstateexception
+                // prior to this IF should  have caught a problem where IN is not supported at all
+                if (firstDirection == Direction.OUT && directionRequested == Direction.IN)
+                    skipEdges(input);
+            }
+
+            if (directionRequested == Direction.BOTH || directionRequested == Direction.IN) {
+                // if the first direction was OUT then it was either read or skipped.  in that case, the marker
+                // of the stream is currently ready to read the IN direction. otherwise it's in the perfect place
+                // to start reading edges
+                if (firstDirection == Direction.OUT)
+                    kryo.readObject(input, Direction.class);
+
+                readEdges(input, edgeMaker);
+            }
+        }
+
+        return v;
+    }
+
+    private void readEdges(final Input input, final Function<DetachedEdge, Edge> edgeMaker) {
+        if (input.readBoolean()) {
+            Object next = kryo.readClassAndObject(input);
+            while (!next.equals(EdgeTerminator.INSTANCE)) {
+                final DetachedEdge detachedEdge = (DetachedEdge) next;
+                edgeMaker.apply(detachedEdge);
+                next = kryo.readClassAndObject(input);
+            }
+        }
+    }
+
+    private void skipEdges(final Input input) {
+        if (input.readBoolean()) {
+            Object next = kryo.readClassAndObject(input);
+            while (!next.equals(EdgeTerminator.INSTANCE)) {
+                // next edge to skip or the terminator
+                next = kryo.readClassAndObject(input);
+            }
+        }
+    }
+
+    /**
+     * Reads through the all the edges for a vertex and writes the edges to a temp file which will be read later.
+     */
+    private void readToEndOfEdgesAndWriteToTemp(final Input input, final Output output) throws IOException {
+        Object next = kryo.readClassAndObject(input);
+        while (!next.equals(EdgeTerminator.INSTANCE)) {
+            kryo.writeClassAndObject(output, next);
+
+            // next edge or terminator
+            next = kryo.readClassAndObject(input);
+        }
+
+        // this should be the vertex terminator
+        kryo.readClassAndObject(input);
+
+        kryo.writeClassAndObject(output, EdgeTerminator.INSTANCE);
+        kryo.writeClassAndObject(output, VertexTerminator.INSTANCE);
+    }
+
+
+    /**
+     * Read the edges from the temp file and load them to the graph.
+     */
+    private void readFromTempEdges(final Input input, final Graph graphToWriteTo) {
+        final List<Object> edgeArgs = new ArrayList<>();
+        while (!input.eof()) {
+            // in this case the outId is the id assigned by the graph
+            Object next = kryo.readClassAndObject(input);
+            while (!next.equals(EdgeTerminator.INSTANCE)) {
+                final DetachedEdge detachedEdge = (DetachedEdge) next;
+                final Vertex vOut = graphToWriteTo.iterators().vertexIterator(detachedEdge.iterators().vertexIterator(Direction.OUT).next().id()).next();
+                final Vertex inV = graphToWriteTo.iterators().vertexIterator(detachedEdge.iterators().vertexIterator(Direction.IN).next().id()).next();
+
+                detachedEdge.iterators().propertyIterator().forEachRemaining(p -> edgeArgs.addAll(Arrays.asList(p.key(), p.value())));
+
+                appendToArgList(edgeArgs, T.id, detachedEdge.id());
+
+                vOut.addEdge(detachedEdge.label(), inV, edgeArgs.toArray());
+
+                edgeArgs.clear();
+                next = kryo.readClassAndObject(input);
+            }
+
+            // vertex terminator
+            kryo.readClassAndObject(input);
+        }
+    }
+
+    @SuppressWarnings("ResultOfMethodCallIgnored")
+    private void deleteTempFileSilently() {
+        try {
+            tempFile.delete();
+        } catch (Exception ignored) {
+        }
+    }
+
+    public static Builder build() {
+        return new Builder();
+    }
+
+    public static class Builder {
+        private File tempFile;
+        private long batchSize = BatchGraph.DEFAULT_BUFFER_SIZE;
+        private String vertexIdKey = T.id.getAccessor();
+        private String edgeIdKey = T.id.getAccessor();
+
+        /**
+         * Always use the most recent gryo version by default
+         */
+        private GryoMapper gryoMapper = GryoMapper.build().create();
+
+        private Builder() {
+            this.tempFile = new File(UUID.randomUUID() + ".tmp");
+        }
+
+        /**
+         * Set the size between commits when reading into the {@link Graph} instance.  This value defaults to
+         * {@link BatchGraph#DEFAULT_BUFFER_SIZE}.
+         */
+        public Builder batchSize(final long batchSize) {
+            this.batchSize = batchSize;
+            return this;
+        }
+
+        /**
+         * Supply a mapper {@link GryoMapper} instance to use as the serializer for the {@code KryoWriter}.
+         */
+        public Builder mapper(final GryoMapper gryoMapper) {
+            this.gryoMapper = gryoMapper;
+            return this;
+        }
+
+        /**
+         * The name of the key to supply to
+         * {@link org.apache.tinkerpop.gremlin.structure.util.batch.BatchGraph.Builder#vertexIdKey} when reading data into
+         * the {@link Graph}.
+         */
+        public Builder vertexIdKey(final String vertexIdKey) {
+            this.vertexIdKey = vertexIdKey;
+            return this;
+        }
+
+        /**
+         * The name of the key to supply to
+         * {@link org.apache.tinkerpop.gremlin.structure.util.batch.BatchGraph.Builder#edgeIdKey} when reading data into
+         * the {@link Graph}.
+         */
+        public Builder edgeIdKey(final String edgeIdKey) {
+            this.edgeIdKey = edgeIdKey;
+            return this;
+        }
+
+        /**
+         * The reader requires a working directory to write temp files to.  If this value is not set, it will write
+         * the temp file to the local directory.
+         */
+        public Builder workingDirectory(final String workingDirectory) {
+            final File f = new File(workingDirectory);
+            if (!f.exists() || !f.isDirectory())
+                throw new IllegalArgumentException(String.format("%s is not a directory or does not exist", workingDirectory));
+
+            tempFile = new File(workingDirectory + File.separator + UUID.randomUUID() + ".tmp");
+            return this;
+        }
+
+        public GryoReader create() {
+            return new GryoReader(tempFile, batchSize, this.vertexIdKey, this.edgeIdKey, this.gryoMapper);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
new file mode 100644
index 0000000..6b31e43
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
@@ -0,0 +1,180 @@
+/*
+ * 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.structure.io.gryo;
+
+import com.esotericsoftware.kryo.Kryo;
+import com.esotericsoftware.kryo.io.Output;
+import org.apache.tinkerpop.gremlin.structure.Direction;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Element;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.io.GraphWriter;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedFactory;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.UUID;
+
+/**
+ * The {@link GraphWriter} for the Gremlin Structure serialization format based on Kryo.  The format is meant to be
+ * non-lossy in terms of Gremlin Structure to Gremlin Structure migrations (assuming both structure implementations
+ * support the same graph features).
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class GryoWriter implements GraphWriter {
+    private Kryo kryo;
+    private final GryoMapper.HeaderWriter headerWriter;
+    private static final UUID delimiter = UUID.fromString("2DEE3ABF-9963-4546-A578-C1C48690D7F7");
+    public static final byte[] DELIMITER = new byte[16];
+
+    static {
+        final ByteBuffer bb = ByteBuffer.wrap(DELIMITER);
+        bb.putLong(delimiter.getMostSignificantBits());
+        bb.putLong(delimiter.getLeastSignificantBits());
+    }
+
+    private GryoWriter(final GryoMapper gryoMapper) {
+        this.kryo = gryoMapper.createMapper();
+        this.headerWriter = gryoMapper.getHeaderWriter();
+    }
+
+    @Override
+    public void writeGraph(final OutputStream outputStream, final Graph g) throws IOException {
+        final Output output = new Output(outputStream);
+        this.headerWriter.write(kryo, output);
+
+        final boolean supportsGraphMemory = g.features().graph().variables().supportsVariables();
+        output.writeBoolean(supportsGraphMemory);
+        if (supportsGraphMemory)
+            kryo.writeObject(output, new HashMap(g.variables().asMap()));
+
+        final Iterator<Vertex> vertices = g.iterators().vertexIterator();
+        final boolean hasSomeVertices = vertices.hasNext();
+        output.writeBoolean(hasSomeVertices);
+        while (vertices.hasNext()) {
+            final Vertex v = vertices.next();
+            writeVertexToOutput(output, v, Direction.OUT);
+        }
+
+        output.flush();
+    }
+
+    @Override
+    public void writeVertex(final OutputStream outputStream, final Vertex v, final Direction direction) throws IOException {
+        final Output output = new Output(outputStream);
+        this.headerWriter.write(kryo, output);
+        writeVertexToOutput(output, v, direction);
+        output.flush();
+    }
+
+    @Override
+    public void writeVertex(final OutputStream outputStream, final Vertex v) throws IOException {
+        final Output output = new Output(outputStream);
+        this.headerWriter.write(kryo, output);
+        writeVertexWithNoEdgesToOutput(output, v);
+        output.flush();
+    }
+
+    @Override
+    public void writeEdge(final OutputStream outputStream, final Edge e) throws IOException {
+        final Output output = new Output(outputStream);
+        this.headerWriter.write(kryo, output);
+        kryo.writeClassAndObject(output, DetachedFactory.detach(e, true));
+        output.flush();
+    }
+
+    private void writeEdgeToOutput(final Output output, final Edge e) {
+        this.writeElement(output, e, null);
+    }
+
+    private void writeVertexWithNoEdgesToOutput(final Output output, final Vertex v) {
+        writeElement(output, v, null);
+    }
+
+    private void writeVertexToOutput(final Output output, final Vertex v, final Direction direction) {
+        this.writeElement(output, v, direction);
+    }
+
+    private void writeElement(final Output output, final Element e, final Direction direction) {
+        kryo.writeClassAndObject(output, e);
+
+        if (e instanceof Vertex) {
+            output.writeBoolean(direction != null);
+            if (direction != null) {
+                final Vertex v = (Vertex) e;
+                kryo.writeObject(output, direction);
+                if (direction == Direction.BOTH || direction == Direction.OUT)
+                    writeDirectionalEdges(output, Direction.OUT, v.iterators().edgeIterator(Direction.OUT));
+
+                if (direction == Direction.BOTH || direction == Direction.IN)
+                    writeDirectionalEdges(output, Direction.IN, v.iterators().edgeIterator(Direction.IN));
+            }
+
+            kryo.writeClassAndObject(output, VertexTerminator.INSTANCE);
+        }
+    }
+
+    private void writeDirectionalEdges(final Output output, final Direction d, final Iterator<Edge> vertexEdges) {
+        final boolean hasEdges = vertexEdges.hasNext();
+        kryo.writeObject(output, d);
+        output.writeBoolean(hasEdges);
+
+        while (vertexEdges.hasNext()) {
+            final Edge edgeToWrite = vertexEdges.next();
+            writeEdgeToOutput(output, edgeToWrite);
+        }
+
+        if (hasEdges)
+            kryo.writeClassAndObject(output, EdgeTerminator.INSTANCE);
+    }
+
+    public static Builder build() {
+        return new Builder();
+    }
+
+    public static class Builder {
+        /**
+         * Always creates the most current version available.
+         */
+        private GryoMapper gryoMapper = GryoMapper.build().create();
+
+        private Builder() {
+        }
+
+        /**
+         * Supply a mapper {@link GryoMapper} instance to use as the serializer for the {@code KryoWriter}.
+         */
+        public Builder mapper(final GryoMapper gryoMapper) {
+            this.gryoMapper = gryoMapper;
+            return this;
+        }
+
+        /**
+         * Create the {@code GryoWriter}.
+         */
+        public GryoWriter create() {
+            return new GryoWriter(this.gryoMapper);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/URISerializer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/URISerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/URISerializer.java
new file mode 100644
index 0000000..c0c7b48
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/URISerializer.java
@@ -0,0 +1,46 @@
+/*
+ * 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.structure.io.gryo;
+
+import com.esotericsoftware.kryo.Kryo;
+import com.esotericsoftware.kryo.Serializer;
+import com.esotericsoftware.kryo.io.Input;
+import com.esotericsoftware.kryo.io.Output;
+
+import java.net.URI;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+class URISerializer extends Serializer<URI> {
+
+    public URISerializer() {
+        setImmutable(true);
+    }
+
+    @Override
+    public void write(final Kryo kryo, final Output output, final URI uri) {
+        output.writeString(uri.toString());
+    }
+
+    @Override
+    public URI read(final Kryo kryo, final Input input, final Class<URI> uriClass) {
+        return URI.create(input.readString());
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/UUIDSerializer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/UUIDSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/UUIDSerializer.java
new file mode 100644
index 0000000..ffcf199
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/UUIDSerializer.java
@@ -0,0 +1,46 @@
+/*
+ * 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.structure.io.gryo;
+
+import com.esotericsoftware.kryo.Kryo;
+import com.esotericsoftware.kryo.Serializer;
+import com.esotericsoftware.kryo.io.Input;
+import com.esotericsoftware.kryo.io.Output;
+
+import java.util.UUID;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+class UUIDSerializer extends Serializer<UUID> {
+    public UUIDSerializer() {
+        setImmutable(true);
+    }
+
+    @Override
+    public void write(final Kryo kryo, final Output output, final UUID uuid) {
+        output.writeLong(uuid.getMostSignificantBits());
+        output.writeLong(uuid.getLeastSignificantBits());
+    }
+
+    @Override
+    public UUID read(final Kryo kryo, final Input input, final Class<UUID> uuidClass) {
+        return new UUID(input.readLong(), input.readLong());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/VertexByteArrayInputStream.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/VertexByteArrayInputStream.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/VertexByteArrayInputStream.java
new file mode 100644
index 0000000..3544009
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/VertexByteArrayInputStream.java
@@ -0,0 +1,74 @@
+/*
+ * 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.structure.io.gryo;
+
+import java.io.ByteArrayOutputStream;
+import java.io.FilterInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * An {@link InputStream} implementation that can independently process a Gryo file written with
+ * {@link GryoWriter#writeVertices(java.io.OutputStream, org.apache.tinkerpop.gremlin.process.Traversal)}.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class VertexByteArrayInputStream extends FilterInputStream {
+
+    private static final byte[] vertexTerminatorClass = new byte[]{15, 1, 1, 9};
+    private static final byte[] pattern = ByteBuffer.allocate(vertexTerminatorClass.length + 8).put(vertexTerminatorClass).putLong(4185403236219066774L).array();
+
+    public VertexByteArrayInputStream(final InputStream inputStream) {
+        super(inputStream);
+    }
+
+    /**
+     * Read the bytes of the next {@link org.apache.tinkerpop.gremlin.structure.Vertex} in the stream. The returned
+     * stream can then be passed to {@link GryoReader#readVertex(java.io.InputStream, java.util.function.Function)}.
+     */
+    public ByteArrayOutputStream readVertexBytes() throws IOException {
+        final ByteArrayOutputStream stream = new ByteArrayOutputStream();
+        final LinkedList<Byte> buffer = new LinkedList<>();
+
+        int current = read();
+        while (current > -1 && (buffer.size() < 12 || !isMatch(buffer))) {
+            stream.write(current);
+
+            current = read();
+            if (buffer.size() > 11)
+                buffer.removeFirst();
+
+            buffer.addLast((byte) current);
+        }
+
+        return stream;
+    }
+
+    private static boolean isMatch(final List<Byte> input) {
+        for (int i = 0; i < pattern.length; i++) {
+            if (pattern[i] != input.get(i)) {
+                return false;
+            }
+        }
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/VertexTerminator.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/VertexTerminator.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/VertexTerminator.java
new file mode 100644
index 0000000..7f056ae
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/VertexTerminator.java
@@ -0,0 +1,53 @@
+/*
+ * 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.structure.io.gryo;
+
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+
+/**
+ * Represents the end of a vertex in a serialization stream.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+class VertexTerminator {
+    public static final VertexTerminator INSTANCE = new VertexTerminator();
+
+    public final byte[] terminal;
+
+    private VertexTerminator() {
+        terminal = ByteBuffer.allocate(8).putLong(4185403236219066774L).array();
+    }
+
+    @Override
+    public boolean equals(final Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        final VertexTerminator that = (VertexTerminator) o;
+
+        return terminal == that.terminal;
+
+    }
+
+    @Override
+    public int hashCode() {
+        return Arrays.hashCode(terminal);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/EdgeTerminator.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/EdgeTerminator.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/EdgeTerminator.java
deleted file mode 100644
index 17ab9f3..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/EdgeTerminator.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.structure.io.kryo;
-
-/**
- * Represents the end of an edge list in a serialization stream.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-class EdgeTerminator {
-    public static final EdgeTerminator INSTANCE = new EdgeTerminator();
-    private final boolean terminal;
-
-    private EdgeTerminator() {
-        this.terminal = true;
-    }
-
-    @Override
-    public boolean equals(final Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
-        final EdgeTerminator that = (EdgeTerminator) o;
-
-        return terminal == that.terminal;
-    }
-
-    @Override
-    public int hashCode() {
-        return (terminal ? 1 : 0);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/EntrySerializer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/EntrySerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/EntrySerializer.java
deleted file mode 100644
index befd18c..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/EntrySerializer.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.structure.io.kryo;
-
-import com.esotericsoftware.kryo.Kryo;
-import com.esotericsoftware.kryo.Serializer;
-import com.esotericsoftware.kryo.io.Input;
-import com.esotericsoftware.kryo.io.Output;
-
-import java.util.AbstractMap;
-import java.util.Map;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-class EntrySerializer extends Serializer<Map.Entry> {
-    @Override
-    public void write(final Kryo kryo, final Output output, final Map.Entry entry) {
-        kryo.writeClassAndObject(output, entry.getKey());
-        kryo.writeClassAndObject(output, entry.getValue());
-    }
-
-    @Override
-    public Map.Entry read(final Kryo kryo, final Input input, final Class<Map.Entry> entryClass) {
-        return new AbstractMap.SimpleEntry(kryo.readClassAndObject(input), kryo.readClassAndObject(input));
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/GraphSerializer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/GraphSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/GraphSerializer.java
deleted file mode 100644
index dc378e5..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/GraphSerializer.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.structure.io.kryo;
-
-import com.esotericsoftware.kryo.Kryo;
-import com.esotericsoftware.kryo.Serializer;
-import com.esotericsoftware.kryo.io.Input;
-import com.esotericsoftware.kryo.io.Output;
-import org.apache.tinkerpop.gremlin.process.Path;
-import org.apache.tinkerpop.gremlin.process.Traverser;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.Property;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.structure.VertexProperty;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedFactory;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedPath;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedProperty;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertexProperty;
-
-/**
- * Class used to serialize graph-based objects such as vertices, edges, properties, and paths.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-class GraphSerializer {
-    /**
-     * Serializes any {@link Edge} implementation encountered to a {@link DetachedEdge}.
-     *
-     * @author Stephen Mallette (http://stephen.genoprime.com)
-     */
-    static class EdgeSerializer extends Serializer<Edge> {
-        @Override
-        public void write(final Kryo kryo, final Output output, final Edge edge) {
-            kryo.writeClassAndObject(output, DetachedFactory.detach(edge, true));
-        }
-
-        @Override
-        public Edge read(final Kryo kryo, final Input input, final Class<Edge> edgeClass) {
-            final Object o = kryo.readClassAndObject(input);
-            return (Edge) o;
-        }
-    }
-
-    /**
-     * Serializes any {@link Vertex} implementation encountered to an {@link DetachedVertex}.
-     *
-     * @author Stephen Mallette (http://stephen.genoprime.com)
-     */
-    static class VertexSerializer extends Serializer<Vertex> {
-        public VertexSerializer() {
-        }
-
-        @Override
-        public void write(final Kryo kryo, final Output output, final Vertex vertex) {
-            kryo.writeClassAndObject(output, DetachedFactory.detach(vertex, true));
-        }
-
-        @Override
-        public Vertex read(final Kryo kryo, final Input input, final Class<Vertex> vertexClass) {
-            return (Vertex) kryo.readClassAndObject(input);
-        }
-    }
-
-    /**
-     * Serializes any {@link Property} implementation encountered to an {@link DetachedProperty}.
-     *
-     * @author Stephen Mallette (http://stephen.genoprime.com)
-     */
-    static class PropertySerializer extends Serializer<Property> {
-        public PropertySerializer() {
-        }
-
-        @Override
-        public void write(final Kryo kryo, final Output output, final Property property) {
-            kryo.writeClassAndObject(output, DetachedFactory.detach(property));
-        }
-
-        @Override
-        public Property read(final Kryo kryo, final Input input, final Class<Property> propertyClass) {
-            return (Property) kryo.readClassAndObject(input);
-        }
-    }
-
-    /**
-     * Serializes any {@link VertexProperty} implementation encountered to an {@link DetachedVertexProperty}.
-     *
-     * @author Stephen Mallette (http://stephen.genoprime.com)
-     */
-    static class VertexPropertySerializer extends Serializer<VertexProperty> {
-        public VertexPropertySerializer() {
-        }
-
-        @Override
-        public void write(final Kryo kryo, final Output output, final VertexProperty vertexProperty) {
-            kryo.writeClassAndObject(output, DetachedFactory.detach(vertexProperty, true));
-        }
-
-        @Override
-        public VertexProperty read(final Kryo kryo, final Input input, final Class<VertexProperty> vertexPropertyClass) {
-            return (VertexProperty) kryo.readClassAndObject(input);
-        }
-    }
-
-    /**
-     * Serializes any {@link Path} implementation encountered to an {@link DetachedPath}.
-     *
-     * @author Marko A. Rodriguez (http://markorodriguez.com)
-     */
-    static class PathSerializer extends Serializer<Path> {
-        public PathSerializer() {
-        }
-
-        @Override
-        public void write(final Kryo kryo, final Output output, final Path path) {
-            kryo.writeClassAndObject(output, DetachedFactory.detach(path, false));
-        }
-
-        @Override
-        public Path read(final Kryo kryo, final Input input, final Class<Path> pathClass) {
-            return (Path) kryo.readClassAndObject(input);
-        }
-
-    }
-
-    /**
-     * Serializes any {@link Traverser} implementation encountered via pre-processing with {@link Traverser.Admin#detach()}.
-     *
-     * @author Marko A. Rodriguez (http://markorodriguez.com)
-     */
-    /*static class TraverserSerializer extends Serializer<Traverser.Admin> {
-        public TraverserSerializer() {
-        }
-
-        @Override
-        public void write(final Kryo kryo, final Output output, final Traverser.Admin traverser) {
-            kryo.writeClassAndObject(output, traverser.asAdmin().detach());
-        }
-
-        @Override
-        public Traverser.Admin read(final Kryo kryo, final Input input, final Class<Traverser.Admin> traverser) {
-            return (Traverser.Admin) kryo.readClassAndObject(input);
-        }
-
-    }*/
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/GremlinClassResolver.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/GremlinClassResolver.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/GremlinClassResolver.java
deleted file mode 100644
index a7c48b9..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/GremlinClassResolver.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.structure.io.kryo;
-
-import com.esotericsoftware.kryo.ClassResolver;
-import com.esotericsoftware.kryo.Kryo;
-import com.esotericsoftware.kryo.KryoException;
-import com.esotericsoftware.kryo.Registration;
-import com.esotericsoftware.kryo.io.Input;
-import com.esotericsoftware.kryo.io.Output;
-import com.esotericsoftware.kryo.util.IdentityObjectIntMap;
-import com.esotericsoftware.kryo.util.IntMap;
-import com.esotericsoftware.kryo.util.ObjectMap;
-import org.apache.tinkerpop.gremlin.process.Path;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.Property;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.structure.VertexProperty;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedPath;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedProperty;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertexProperty;
-
-import static com.esotericsoftware.kryo.util.Util.getWrapperClass;
-
-/**
- * This mapper implementation of the {@code ClassResolver} helps ensure that all Vertex and Edge concrete classes
- * get properly serialized and deserialized by stripping them of their concrete class name so that they are treated
- * generically.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-class GremlinClassResolver implements ClassResolver {
-    static public final byte NAME = -1;
-
-    protected Kryo kryo;
-
-    protected final IntMap<Registration> idToRegistration = new IntMap<>();
-    protected final ObjectMap<Class, Registration> classToRegistration = new ObjectMap<>();
-
-    protected IdentityObjectIntMap<Class> classToNameId;
-    protected IntMap<Class> nameIdToClass;
-    protected ObjectMap<String, Class> nameToClass;
-    protected int nextNameId;
-
-    private int memoizedClassId = -1;
-    private Registration memoizedClassIdValue;
-    private Class memoizedClass;
-    private Registration memoizedClassValue;
-
-    @Override
-    public void setKryo(Kryo kryo) {
-        this.kryo = kryo;
-    }
-
-    @Override
-    public Registration register(final Registration registration) {
-        if (null == registration) throw new IllegalArgumentException("Registration cannot be null.");
-        if (registration.getId() != NAME) idToRegistration.put(registration.getId(), registration);
-
-        classToRegistration.put(registration.getType(), registration);
-        if (registration.getType().isPrimitive())
-            classToRegistration.put(getWrapperClass(registration.getType()), registration);
-        return registration;
-    }
-
-    @Override
-    public Registration registerImplicit(final Class type) {
-        return register(new Registration(type, kryo.getDefaultSerializer(type), NAME));
-    }
-
-    @Override
-    public Registration getRegistration(final Class clazz) {
-        // force all instances of Vertex, Edge, VertexProperty, etc. to their respective interface
-        final Class type;
-        if (!DetachedVertex.class.isAssignableFrom(clazz) && Vertex.class.isAssignableFrom(clazz))
-            type = Vertex.class;
-        else if (!DetachedEdge.class.isAssignableFrom(clazz) && Edge.class.isAssignableFrom(clazz))
-            type = Edge.class;
-        else if (!DetachedVertexProperty.class.isAssignableFrom(clazz) && VertexProperty.class.isAssignableFrom(clazz))
-            type = VertexProperty.class;
-        else if (!DetachedProperty.class.isAssignableFrom(clazz) && !DetachedVertexProperty.class.isAssignableFrom(clazz) && Property.class.isAssignableFrom(clazz))
-            type = Property.class;
-        else if (!DetachedPath.class.isAssignableFrom(clazz) && Path.class.isAssignableFrom(clazz))
-            type = Path.class;
-        else
-            type = clazz;
-
-        if (type == memoizedClass) return memoizedClassValue;
-        final Registration registration = classToRegistration.get(type);
-        if (registration != null) {
-            memoizedClass = type;
-            memoizedClassValue = registration;
-        }
-
-        return registration;
-    }
-
-    @Override
-    public Registration getRegistration(final int classID) {
-        return idToRegistration.get(classID);
-    }
-
-    @Override
-    public Registration writeClass(final Output output, final Class type) {
-        if (null == type) {
-            output.writeVarInt(Kryo.NULL, true);
-            return null;
-        }
-
-        final Registration registration = kryo.getRegistration(type);
-        if (registration.getId() == NAME)
-            writeName(output, type);
-        else
-            output.writeVarInt(registration.getId() + 2, true);
-
-        return registration;
-    }
-
-    protected void writeName(final Output output, final Class type) {
-        output.writeVarInt(NAME + 2, true);
-        if (classToNameId != null) {
-            final int nameId = classToNameId.get(type, -1);
-            if (nameId != -1) {
-                output.writeVarInt(nameId, true);
-                return;
-            }
-        }
-        // Only write the class name the first time encountered in object graph.
-        final int nameId = nextNameId++;
-        if (classToNameId == null) classToNameId = new IdentityObjectIntMap<>();
-        classToNameId.put(type, nameId);
-        output.writeVarInt(nameId, true);
-        output.writeString(type.getName());
-    }
-
-    @Override
-    public Registration readClass(final Input input) {
-        final int classID = input.readVarInt(true);
-        switch (classID) {
-            case Kryo.NULL:
-                return null;
-            case NAME + 2: // Offset for NAME and NULL.
-                return readName(input);
-        }
-
-        if (classID == memoizedClassId) return memoizedClassIdValue;
-        final Registration registration = idToRegistration.get(classID - 2);
-        if (registration == null) throw new KryoException("Encountered unregistered class ID: " + (classID - 2));
-        memoizedClassId = classID;
-        memoizedClassIdValue = registration;
-        return registration;
-    }
-
-    protected Registration readName(final Input input) {
-        final int nameId = input.readVarInt(true);
-        if (nameIdToClass == null) nameIdToClass = new IntMap<>();
-        Class type = nameIdToClass.get(nameId);
-        if (type == null) {
-            // Only read the class name the first time encountered in object graph.
-            final String className = input.readString();
-            type = getTypeByName(className);
-            if (type == null) {
-                try {
-                    type = Class.forName(className, false, kryo.getClassLoader());
-                } catch (ClassNotFoundException ex) {
-                    throw new KryoException("Unable to find class: " + className, ex);
-                }
-                if (nameToClass == null) nameToClass = new ObjectMap<>();
-                nameToClass.put(className, type);
-            }
-            nameIdToClass.put(nameId, type);
-        }
-        return kryo.getRegistration(type);
-    }
-
-    protected Class<?> getTypeByName(final String className) {
-        return nameToClass != null ? nameToClass.get(className) : null;
-    }
-
-    @Override
-    public void reset() {
-        if (!kryo.isRegistrationRequired()) {
-            if (classToNameId != null) classToNameId.clear();
-            if (nameIdToClass != null) nameIdToClass.clear();
-            nextNameId = 0;
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/929a2889/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/KryoMapper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/KryoMapper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/KryoMapper.java
deleted file mode 100644
index 5a35d87..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/kryo/KryoMapper.java
+++ /dev/null
@@ -1,406 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.structure.io.kryo;
-
-import com.esotericsoftware.kryo.Kryo;
-import com.esotericsoftware.kryo.KryoSerializable;
-import com.esotericsoftware.kryo.Serializer;
-import com.esotericsoftware.kryo.io.Input;
-import com.esotericsoftware.kryo.io.Output;
-import com.esotericsoftware.kryo.util.DefaultStreamFactory;
-import com.esotericsoftware.kryo.util.MapReferenceResolver;
-import org.apache.tinkerpop.gremlin.process.Path;
-import org.apache.tinkerpop.gremlin.process.T;
-import org.apache.tinkerpop.gremlin.process.computer.MapReduce;
-import org.apache.tinkerpop.gremlin.process.computer.util.MapMemory;
-import org.apache.tinkerpop.gremlin.process.graph.util.Tree;
-import org.apache.tinkerpop.gremlin.process.traverser.B_O_PA_S_SE_SL_Traverser;
-import org.apache.tinkerpop.gremlin.process.traverser.B_O_P_PA_S_SE_SL_Traverser;
-import org.apache.tinkerpop.gremlin.process.traverser.B_O_Traverser;
-import org.apache.tinkerpop.gremlin.process.traverser.O_Traverser;
-import org.apache.tinkerpop.gremlin.process.util.BulkSet;
-import org.apache.tinkerpop.gremlin.process.util.metric.DependantMutableMetrics;
-import org.apache.tinkerpop.gremlin.process.util.metric.MutableMetrics;
-import org.apache.tinkerpop.gremlin.process.util.metric.StandardTraversalMetrics;
-import org.apache.tinkerpop.gremlin.process.util.TraverserSet;
-import org.apache.tinkerpop.gremlin.structure.Contains;
-import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.Property;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.structure.VertexProperty;
-import org.apache.tinkerpop.gremlin.structure.io.Mapper;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedPath;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedProperty;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertexProperty;
-import org.javatuples.Triplet;
-
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.net.URI;
-import java.util.*;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.function.BiPredicate;
-import java.util.function.Function;
-import java.util.function.Predicate;
-import java.util.stream.Collectors;
-
-/**
- * A {@link Mapper} implementation for Kryo.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public final class KryoMapper implements Mapper<Kryo> {
-    static final byte[] GIO = "gio".getBytes();
-    private final List<Triplet<Class, Function<Kryo, Serializer>, Integer>> serializationList;
-    private final HeaderWriter headerWriter;
-    private final HeaderReader headerReader;
-    private final byte[] versionedHeader;
-
-    public static final byte DEFAULT_EXTENDED_VERSION = Byte.MIN_VALUE;
-
-    private KryoMapper(final List<Triplet<Class, Function<Kryo, Serializer>, Integer>> serializationList,
-                       final HeaderWriter headerWriter,
-                       final HeaderReader headerReader) {
-        this.serializationList = serializationList;
-        this.headerWriter = headerWriter;
-        this.headerReader = headerReader;
-
-        final Output out = new Output(32);
-        try {
-            this.headerWriter.write(createMapper(), out);
-        } catch (IOException ioe) {
-            throw new RuntimeException(ioe);
-        }
-        this.versionedHeader = out.toBytes();
-    }
-
-    @Override
-    public Kryo createMapper() {
-        final Kryo kryo = new Kryo(new GremlinClassResolver(), new MapReferenceResolver(), new DefaultStreamFactory());
-        kryo.addDefaultSerializer(Map.Entry.class, new EntrySerializer());
-        kryo.setRegistrationRequired(true);
-        serializationList.forEach(p -> {
-            final Function<Kryo, Serializer> serializer = p.getValue1();
-            if (null == serializer)
-                kryo.register(p.getValue0(), kryo.getDefaultSerializer(p.getValue0()), p.getValue2());
-            else
-                kryo.register(p.getValue0(), serializer.apply(kryo), p.getValue2());
-        });
-        return kryo;
-    }
-
-    public HeaderWriter getHeaderWriter() {
-        return headerWriter;
-    }
-
-    public HeaderReader getHeaderReader() {
-        return headerReader;
-    }
-
-    /**
-     * Gets the header for a Gremlin Kryo file, which is based on the version of Gremlin Kryo that is constructed
-     * via the builder classes.
-     */
-    public byte[] getVersionedHeader() {
-        return versionedHeader;
-    }
-
-    @FunctionalInterface
-    public interface HeaderReader {
-        public void read(final Kryo kryo, final Input input) throws IOException;
-    }
-
-    @FunctionalInterface
-    public interface HeaderWriter {
-        public void write(final Kryo kryo, final Output output) throws IOException;
-    }
-
-    /**
-     * Use a specific version of Gremlin Kryo.
-     */
-    public static Builder build(final Version version) {
-        return version.getBuilder();
-    }
-
-    /**
-     * Use the most current version of Gremlin Kryo.
-     */
-    public static Builder build() {
-        return Version.V_1_0_0.getBuilder();
-    }
-
-    public static interface Builder {
-        /**
-         * Add mapper classes to serializes with kryo using standard serialization.
-         */
-        public Builder addCustom(final Class... custom);
-
-        /**
-         * Add mapper class to serializes with mapper serialization.
-         */
-        public Builder addCustom(final Class clazz, final Serializer serializer);
-
-        /**
-         * Add mapper class to serializes with mapper serialization as returned from a {@link Function}.
-         */
-        public Builder addCustom(final Class clazz, final Function<Kryo, Serializer> serializer);
-
-        /**
-         * If using mapper classes it might be useful to tag the version stamped to the serialization with a mapper
-         * value, such that Kryo serialization at 1.0.0 would have a fourth byte for an extended version.  The user
-         * supplied fourth byte can then be used to ensure the right deserializer is used to read the data. If this
-         * value is not supplied then it is written as {@link Byte#MIN_VALUE}. The value supplied here should be greater
-         * than or equal to zero.
-         */
-        public Builder extendedVersion(final byte extendedVersion);
-
-        /**
-         * By default the {@link #extendedVersion(byte)} is checked against what is read from an input source and if
-         * those values are equal the version being read is considered "compliant".  To alter this behavior, supply a
-         * mapper compliance {@link Predicate} to evaluate the value read from the input source (i.e. first argument)
-         * and the value marked in the {@code GremlinKryo} instance {i.e. second argument}.  Supplying this function is
-         * useful when versions require backward compatibility or other more complex checks.  This function is only used
-         * if the {@link #extendedVersion(byte)} is set to something other than its default.
-         */
-        public Builder compliant(final BiPredicate<Byte, Byte> compliant);
-
-        public KryoMapper create();
-    }
-
-    public enum Version {
-        V_1_0_0(BuilderV1d0.class);
-
-        private final Class<? extends Builder> builder;
-
-        private Version(final Class<? extends Builder> builder) {
-            this.builder = builder;
-        }
-
-        Builder getBuilder() {
-            try {
-                return builder.newInstance();
-            } catch (Exception x) {
-                throw new RuntimeException("GremlinKryo Builder implementation cannot be instantiated", x);
-            }
-        }
-    }
-
-    public static class BuilderV1d0 implements Builder {
-
-        /**
-         * Map with one entry that is used so that it is possible to get the class of LinkedHashMap.Entry.
-         */
-        private static final LinkedHashMap m = new LinkedHashMap() {{
-            put("junk", "dummy");
-        }};
-
-        private static final Class LINKED_HASH_MAP_ENTRY_CLASS = m.entrySet().iterator().next().getClass();
-
-        /**
-         * Note that the following are pre-registered boolean, Boolean, byte, Byte, char, Character, double, Double,
-         * int, Integer, float, Float, long, Long, short, Short, String, void.
-         */
-        private final List<Triplet<Class, Function<Kryo, Serializer>, Integer>> serializationList = new ArrayList<Triplet<Class, Function<Kryo, Serializer>, Integer>>() {{
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(byte[].class, null, 25));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(char[].class, null, 26));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(short[].class, null, 27));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(int[].class, null, 28));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(long[].class, null, 29));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(float[].class, null, 30));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(double[].class, null, 31));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(String[].class, null, 32));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Object[].class, null, 33));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(ArrayList.class, null, 10));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(BigInteger.class, null, 34));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(BigDecimal.class, null, 35));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Calendar.class, null, 39));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Class.class, null, 41));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Collection.class, null, 37));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Collections.EMPTY_LIST.getClass(), null, 51));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Collections.EMPTY_MAP.getClass(), null, 52));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Collections.EMPTY_SET.getClass(), null, 53));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Collections.singleton(null).getClass(), null, 54));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Collections.singletonList(null).getClass(), null, 24));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Collections.singletonMap(null, null).getClass(), null, 23));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Contains.class, null, 49));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Currency.class, null, 40));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Date.class, null, 38));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Direction.class, null, 12));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(DetachedEdge.class, null, 21));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(DetachedVertexProperty.class, null, 20));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(DetachedProperty.class, null, 18));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(DetachedVertex.class, null, 19));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(DetachedPath.class, null, 60));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(EdgeTerminator.class, null, 14));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(EnumSet.class, null, 46));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(HashMap.class, null, 11));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(HashMap.Entry.class, null, 16));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(KryoSerializable.class, null, 36));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(LinkedHashMap.class, null, 47));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(LinkedHashSet.class, null, 71));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(LINKED_HASH_MAP_ENTRY_CLASS, null, 15));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Locale.class, null, 22));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(StringBuffer.class, null, 43));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(StringBuilder.class, null, 44));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(T.class, null, 48));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(TimeZone.class, null, 42));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(TreeMap.class, null, 45));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(TreeSet.class, null, 50));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(UUID.class, kryo -> new UUIDSerializer(), 17));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(URI.class, kryo -> new URISerializer(), 72));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(VertexTerminator.class, null, 13));
-
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Edge.class, kryo -> new GraphSerializer.EdgeSerializer(), 65));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Vertex.class, kryo -> new GraphSerializer.VertexSerializer(), 66));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Property.class, kryo -> new GraphSerializer.PropertySerializer(), 67));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(VertexProperty.class, kryo -> new GraphSerializer.VertexPropertySerializer(), 68));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Path.class, kryo -> new GraphSerializer.PathSerializer(), 59));
-            // HACK!
-            //add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Traverser.Admin.class, kryo -> new GraphSerializer.TraverserSerializer(), 55));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(B_O_Traverser.class, null, 75));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(O_Traverser.class, null, 76));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(B_O_P_PA_S_SE_SL_Traverser.class, null, 77));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(B_O_PA_S_SE_SL_Traverser.class, null, 78));
-
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(TraverserSet.class, null, 58));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Tree.class, null, 61));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(HashSet.class, null, 62));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(BulkSet.class, null, 64));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(MutableMetrics.class, null, 69));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(StandardTraversalMetrics.class, null, 70));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(MapMemory.class, null, 73));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(MapReduce.NullObject.class, null, 74));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(AtomicLong.class, null, 79));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(DependantMutableMetrics.class, null, 80));  // ***LAST ID**
-        }};
-
-        private static final byte major = 1;
-        private static final byte minor = 0;
-        private static final byte patchLevel = 0;
-
-        private byte extendedVersion = DEFAULT_EXTENDED_VERSION;
-        private BiPredicate<Byte, Byte> compliant = (readExt, serExt) -> readExt.equals(serExt);
-
-        /**
-         * Starts numbering classes for Kryo serialization at 65536 to leave room for future usage by TinkerPop.
-         */
-        private final AtomicInteger currentSerializationId = new AtomicInteger(65536);
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public Builder addCustom(final Class... custom) {
-            if (custom != null && custom.length > 0)
-                serializationList.addAll(Arrays.asList(custom).stream()
-                        .map(c -> Triplet.<Class, Function<Kryo, Serializer>, Integer>with(c, null, currentSerializationId.getAndIncrement()))
-                        .collect(Collectors.<Triplet<Class, Function<Kryo, Serializer>, Integer>>toList()));
-            return this;
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public Builder addCustom(final Class clazz, final Serializer serializer) {
-            serializationList.add(Triplet.with(clazz, kryo -> serializer, currentSerializationId.getAndIncrement()));
-            return this;
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public Builder addCustom(final Class clazz, final Function<Kryo, Serializer> serializer) {
-            serializationList.add(Triplet.with(clazz, serializer, currentSerializationId.getAndIncrement()));
-            return this;
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public Builder extendedVersion(final byte extendedVersion) {
-            if (extendedVersion > DEFAULT_EXTENDED_VERSION && extendedVersion < 0)
-                throw new IllegalArgumentException("The extendedVersion must be greater than zero");
-
-            this.extendedVersion = extendedVersion;
-            return this;
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public Builder compliant(final BiPredicate<Byte, Byte> compliant) {
-            if (null == compliant)
-                throw new IllegalArgumentException("compliant");
-
-            this.compliant = compliant;
-            return this;
-        }
-
-        @Override
-        public KryoMapper create() {
-            return new KryoMapper(serializationList, this::writeHeader, this::readHeader);
-        }
-
-        private void writeHeader(final Kryo kryo, final Output output) throws IOException {
-            // 32 byte header total
-            output.writeBytes(GIO);
-
-            // some space for later
-            output.writeBytes(new byte[25]);
-
-            // version x.y.z
-            output.writeByte(major);
-            output.writeByte(minor);
-            output.writeByte(patchLevel);
-            output.writeByte(extendedVersion);
-        }
-
-        private void readHeader(final Kryo kryo, final Input input) throws IOException {
-            if (!Arrays.equals(GIO, input.readBytes(3)))
-                throw new IOException("Invalid format - first three bytes of header do not match expected value");
-
-            // skip the next 25 bytes in v1
-            input.readBytes(25);
-
-            // final three bytes of header are the version which should be 1.0.0
-            final byte[] version = input.readBytes(3);
-            final byte extension = input.readByte();
-
-            // direct match on version for now
-            if (version[0] != major || version[1] != minor || version[2] != patchLevel)
-                throw new IOException(String.format(
-                        "The version [%s.%s.%s] in the stream cannot be understood by this reader",
-                        version[0], version[1], version[2]));
-
-            if (extendedVersion >= 0 && !compliant.test(extension, extendedVersion))
-                throw new IOException(String.format(
-                        "The extension [%s] in the input source is not compliant with this configuration of GremlinKryo - [%s]",
-                        extension, extendedVersion));
-        }
-    }
-}


[8/8] incubator-tinkerpop git commit: fixed up spark/ branch now that is is Gryo and .kryo. @spmallette

Posted by ok...@apache.org.
fixed up spark/ branch now that is is Gryo and .kryo. @spmallette


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

Branch: refs/heads/spark
Commit: 96ffd77cc1b33ea9b054e0a32920e7079ecdfd6a
Parents: 70fc529 929a288
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Tue Mar 3 11:10:39 2015 -0700
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Tue Mar 3 11:10:39 2015 -0700

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |   1 +
 data/grateful-dead-vertices.gio                 | Bin 1028298 -> 0 bytes
 data/grateful-dead-vertices.kryo                | Bin 0 -> 1028298 bytes
 data/grateful-dead.gio                          | Bin 515409 -> 0 bytes
 data/grateful-dead.kryo                         | Bin 0 -> 515409 bytes
 data/tinkerpop-classic-vertices.gio             | Bin 1323 -> 0 bytes
 data/tinkerpop-classic-vertices.kryo            | Bin 0 -> 1323 bytes
 data/tinkerpop-classic.gio                      | Bin 817 -> 0 bytes
 data/tinkerpop-classic.kryo                     | Bin 0 -> 817 bytes
 data/tinkerpop-crew-vertices.gio                | Bin 2743 -> 0 bytes
 data/tinkerpop-crew-vertices.kryo               | Bin 0 -> 2743 bytes
 data/tinkerpop-crew.gio                         | Bin 1916 -> 0 bytes
 data/tinkerpop-crew.kryo                        | Bin 0 -> 1916 bytes
 data/tinkerpop-modern-vertices.gio              | Bin 1439 -> 0 bytes
 data/tinkerpop-modern-vertices.kryo             | Bin 0 -> 1439 bytes
 data/tinkerpop-modern.gio                       | Bin 877 -> 0 bytes
 data/tinkerpop-modern.kryo                      | Bin 0 -> 877 bytes
 docs/src/implementations.asciidoc               |  14 +-
 docs/src/the-graph.asciidoc                     |  18 +-
 gremlin-console/conf/remote-objects.yaml        |   2 +-
 gremlin-console/conf/remote.yaml                |   2 +-
 .../plugin/gremlin-server-integration.yaml      |   4 +-
 .../gremlin/console/groovy/plugin/remote.yaml   |   2 +-
 .../util/metric/DependantMutableMetrics.java    |   2 +-
 .../process/util/metric/MutableMetrics.java     |   2 +-
 .../tinkerpop/gremlin/structure/Graph.java      |  50 +--
 .../gremlin/structure/io/DefaultIo.java         |   8 +-
 .../gremlin/structure/io/GraphMigrator.java     |  18 +-
 .../structure/io/gryo/EdgeTerminator.java       |  48 +++
 .../structure/io/gryo/EntrySerializer.java      |  43 ++
 .../structure/io/gryo/GraphSerializer.java      | 164 ++++++++
 .../structure/io/gryo/GremlinClassResolver.java | 206 ++++++++++
 .../gremlin/structure/io/gryo/GryoMapper.java   | 406 +++++++++++++++++++
 .../gremlin/structure/io/gryo/GryoReader.java   | 400 ++++++++++++++++++
 .../gremlin/structure/io/gryo/GryoWriter.java   | 180 ++++++++
 .../structure/io/gryo/URISerializer.java        |  46 +++
 .../structure/io/gryo/UUIDSerializer.java       |  46 +++
 .../io/gryo/VertexByteArrayInputStream.java     |  74 ++++
 .../structure/io/gryo/VertexTerminator.java     |  53 +++
 .../structure/io/kryo/EdgeTerminator.java       |  48 ---
 .../structure/io/kryo/EntrySerializer.java      |  43 --
 .../structure/io/kryo/GraphSerializer.java      | 164 --------
 .../structure/io/kryo/GremlinClassResolver.java | 206 ----------
 .../gremlin/structure/io/kryo/KryoMapper.java   | 406 -------------------
 .../gremlin/structure/io/kryo/KryoReader.java   | 400 ------------------
 .../gremlin/structure/io/kryo/KryoWriter.java   | 180 --------
 .../structure/io/kryo/URISerializer.java        |  46 ---
 .../structure/io/kryo/UUIDSerializer.java       |  46 ---
 .../io/kryo/VertexByteArrayInputStream.java     |  74 ----
 .../structure/io/kryo/VertexTerminator.java     |  53 ---
 .../tinkerpop/gremlin/driver/Cluster.java       |   2 +-
 .../driver/ser/GryoMessageSerializerV1d0.java   | 307 ++++++++++++++
 .../driver/ser/JsonBuilderGryoSerializer.java   |  45 ++
 .../driver/ser/JsonBuilderKryoSerializer.java   |  45 --
 .../driver/ser/KryoMessageSerializerV1d0.java   | 307 --------------
 .../tinkerpop/gremlin/driver/ser/SerTokens.java |   2 +-
 .../gremlin/driver/ser/Serializers.java         |   6 +-
 .../gremlin/driver/simple/NioClient.java        |   4 +-
 .../gremlin/driver/simple/WebSocketClient.java  |   4 +-
 .../ser/GryoMessageSerializerV1D0Test.java      | 294 ++++++++++++++
 .../ser/KryoMessageSerializerV1d0Test.java      | 294 --------------
 .../jsr223/GremlinGroovyScriptEngineTest.java   |  81 ++--
 .../AbstractImportCustomizerProvider.java       |   4 +-
 gremlin-server/conf/gremlin-server-classic.yaml |   4 +-
 gremlin-server/conf/gremlin-server-modern.yaml  |   4 +-
 gremlin-server/conf/gremlin-server-neo4j.yaml   |   4 +-
 gremlin-server/conf/gremlin-server.yaml         |   4 +-
 .../server/GremlinAdditionPerformanceTest.java  |   2 +-
 .../server/GremlinDriverIntegrateTest.java      |  10 +-
 .../server/gremlin-server-integration.yaml      |   4 +-
 .../server/gremlin-server-performance.yaml      |   2 +-
 .../gremlin/AbstractGraphProvider.java          |   8 +-
 .../apache/tinkerpop/gremlin/LoadGraphWith.java |  10 +-
 .../structure/GraphWritePerformanceTest.java    |   6 +-
 .../tinkerpop/gremlin/structure/IoTest.java     | 180 ++++----
 .../gremlin/structure/SerializationTest.java    |  27 +-
 .../structure/io/gryo/GryoResourceAccess.java   |  27 ++
 .../structure/io/kryo/KryoResourceAccess.java   |  27 --
 .../io/gryo/grateful-dead-vertices.kryo         | Bin 0 -> 1028298 bytes
 .../structure/io/gryo/grateful-dead.kryo        | Bin 0 -> 515409 bytes
 .../io/gryo/tinkerpop-classic-vertices.kryo     | Bin 0 -> 1323 bytes
 .../structure/io/gryo/tinkerpop-classic.kryo    | Bin 0 -> 817 bytes
 .../io/gryo/tinkerpop-crew-vertices.kryo        | Bin 0 -> 2743 bytes
 .../structure/io/gryo/tinkerpop-crew.kryo       | Bin 0 -> 1916 bytes
 .../io/gryo/tinkerpop-modern-vertices.kryo      | Bin 0 -> 1439 bytes
 .../structure/io/gryo/tinkerpop-modern.kryo     | Bin 0 -> 877 bytes
 .../io/kryo/grateful-dead-vertices.gio          | Bin 1028298 -> 0 bytes
 .../gremlin/structure/io/kryo/grateful-dead.gio | Bin 515409 -> 0 bytes
 .../io/kryo/tinkerpop-classic-vertices.gio      | Bin 1323 -> 0 bytes
 .../structure/io/kryo/tinkerpop-classic.gio     | Bin 817 -> 0 bytes
 .../io/kryo/tinkerpop-crew-vertices.gio         | Bin 2743 -> 0 bytes
 .../structure/io/kryo/tinkerpop-crew.gio        | Bin 1916 -> 0 bytes
 .../io/kryo/tinkerpop-modern-vertices.gio       | Bin 1439 -> 0 bytes
 .../structure/io/kryo/tinkerpop-modern.gio      | Bin 877 -> 0 bytes
 .../structure/io/gryo/GryoMapperTest.java       |  34 ++
 .../structure/io/kryo/KryoMapperTest.java       |  34 --
 hadoop-gremlin/conf/giraph-gryo.properties      |  31 ++
 hadoop-gremlin/conf/giraph-kryo.properties      |  31 --
 hadoop-gremlin/conf/spark-kryo.properties       |   6 +-
 .../groovy/plugin/HadoopGremlinPlugin.java      |   4 +-
 .../computer/giraph/GiraphComputeVertex.java    |   8 +-
 .../process/computer/giraph/RuleWritable.java   |   4 +-
 .../process/computer/spark/SparkVertex.java     |  12 +-
 .../hadoop/structure/io/ObjectWritable.java     |   4 +-
 .../hadoop/structure/io/VertexWritable.java     |   8 +-
 .../structure/io/gryo/GryoInputFormat.java      |  63 +++
 .../structure/io/gryo/GryoOutputFormat.java     |  43 ++
 .../structure/io/gryo/GryoRecordReader.java     | 113 ++++++
 .../structure/io/gryo/GryoRecordWriter.java     |  54 +++
 .../structure/io/gryo/VertexStreamIterator.java | 147 +++++++
 .../structure/io/kryo/KryoInputFormat.java      |  63 ---
 .../structure/io/kryo/KryoOutputFormat.java     |  43 --
 .../structure/io/kryo/KryoRecordReader.java     | 113 ------
 .../structure/io/kryo/KryoRecordWriter.java     |  54 ---
 .../structure/io/kryo/VertexStreamIterator.java | 147 -------
 .../gremlin/hadoop/HadoopGraphProvider.java     |  30 +-
 .../io/graphson/VertexStreamIteratorTest.java   |   6 +-
 .../io/gryo/GryoRecordReaderWriterTest.java     | 113 ++++++
 .../io/kryo/KryoRecordReaderWriterTest.java     | 113 ------
 pom.xml                                         |   2 +-
 tinkergraph-gremlin/pom.xml                     |   6 +-
 .../tinkergraph/structure/TinkerGraphTest.java  |  55 ++-
 122 files changed, 3266 insertions(+), 3244 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/96ffd77c/hadoop-gremlin/conf/giraph-gryo.properties
----------------------------------------------------------------------
diff --cc hadoop-gremlin/conf/giraph-gryo.properties
index 0000000,0000000..7813ad7
new file mode 100644
--- /dev/null
+++ b/hadoop-gremlin/conf/giraph-gryo.properties
@@@ -1,0 -1,0 +1,31 @@@
++# 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.
++gremlin.graph=org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph
++gremlin.hadoop.graphInputFormat=org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoInputFormat
++gremlin.hadoop.graphOutputFormat=org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoOutputFormat
++gremlin.hadoop.memoryOutputFormat=org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat
++gremlin.hadoop.deriveMemory=false
++gremlin.hadoop.jarsInDistributedCache=true
++
++gremlin.hadoop.inputLocation=tinkerpop-modern-vertices.kryo
++gremlin.hadoop.outputLocation=output
++#gremlin.vertexProgram=org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalVertexProgram
++#gremlin.traversalVertexProgram.traversalSupplier.type=CLASS
++#gremlin.traversalVertexProgram.traversalSupplier.object=org.apache.tinkerpop.gremlin.hadoop.process.computer.example.TraversalSupplier1
++
++giraph.minWorkers=2
++giraph.maxWorkers=2

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/96ffd77c/hadoop-gremlin/conf/spark-kryo.properties
----------------------------------------------------------------------
diff --cc hadoop-gremlin/conf/spark-kryo.properties
index 483349f,0000000..85426a0
mode 100644,000000..100644
--- a/hadoop-gremlin/conf/spark-kryo.properties
+++ b/hadoop-gremlin/conf/spark-kryo.properties
@@@ -1,38 -1,0 +1,38 @@@
 +#
 +# 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.
 +#
 +
 +gremlin.graph=org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph
- gremlin.hadoop.graphInputFormat=org.apache.tinkerpop.gremlin.hadoop.structure.io.kryo.KryoInputFormat
- gremlin.hadoop.graphOutputFormat=org.apache.tinkerpop.gremlin.hadoop.structure.io.kryo.KryoOutputFormat
++gremlin.hadoop.graphInputFormat=org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoInputFormat
++gremlin.hadoop.graphOutputFormat=org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoOutputFormat
 +gremlin.hadoop.memoryOutputFormat=org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat
 +gremlin.hadoop.deriveMemory=false
 +gremlin.hadoop.jarsInDistributedCache=false
 +
- gremlin.hadoop.inputLocation=hdfs://localhost:9000/user/marko/tinkerpop-modern-vertices.gio
++gremlin.hadoop.inputLocation=hdfs://localhost:9000/user/marko/tinkerpop-modern-vertices.kryo
 +gremlin.hadoop.outputLocation=output
 +
 +# the vertex program to execute
 +gremlin.vertexProgram=org.apache.tinkerpop.gremlin.process.computer.ranking.pagerank.PageRankVertexProgram
 +
 +# It is possible to provide Spark configuration parameters for use with SparkGraphComputer
 +##########################################################################################
 +spark.master=local[4]
 +spark.executor.memory=1024m
 +spark.eventLog.enabled=true
 +spark.serializer=org.apache.spark.serializer.JavaSerializer

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/96ffd77c/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/spark/SparkVertex.java
----------------------------------------------------------------------
diff --cc hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/spark/SparkVertex.java
index 38f8a61,0000000..0a02156
mode 100644,000000..100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/spark/SparkVertex.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/spark/SparkVertex.java
@@@ -1,149 -1,0 +1,149 @@@
 +/*
 + * 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.hadoop.process.computer.spark;
 +
 +import org.apache.tinkerpop.gremlin.structure.Direction;
 +import org.apache.tinkerpop.gremlin.structure.Edge;
 +import org.apache.tinkerpop.gremlin.structure.Graph;
 +import org.apache.tinkerpop.gremlin.structure.Vertex;
 +import org.apache.tinkerpop.gremlin.structure.VertexProperty;
- import org.apache.tinkerpop.gremlin.structure.io.kryo.KryoReader;
- import org.apache.tinkerpop.gremlin.structure.io.kryo.KryoWriter;
++import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader;
++import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter;
 +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
 +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerVertex;
 +
 +import java.io.ByteArrayInputStream;
 +import java.io.ByteArrayOutputStream;
 +import java.io.IOException;
 +import java.io.ObjectInputStream;
 +import java.io.ObjectOutputStream;
 +import java.io.Serializable;
 +import java.util.Iterator;
 +
 +/**
 + * @author Marko A. Rodriguez (http://markorodriguez.com)
 + */
 +public final class SparkVertex implements Vertex, Vertex.Iterators, Serializable {
 +
-     private static KryoWriter KRYO_WRITER = KryoWriter.build().create();
-     private static KryoReader KRYO_READER = KryoReader.build().create();
++    private static GryoWriter GRYO_WRITER = GryoWriter.build().create();
++    private static GryoReader GRYO_READER = GryoReader.build().create();
 +    private static final String VERTEX_ID = Graph.Hidden.hide("giraph.gremlin.vertexId");
 +
 +    private transient TinkerVertex vertex;
 +    private byte[] vertexBytes;
 +
 +    public SparkVertex(final TinkerVertex vertex) {
 +        this.vertex = vertex;
 +        this.vertex.graph().variables().set(VERTEX_ID, this.vertex.id());
 +    }
 +
 +    @Override
 +    public Edge addEdge(final String label, final Vertex inVertex, final Object... keyValues) {
 +        return this.vertex.addEdge(label, inVertex, keyValues);
 +    }
 +
 +    @Override
 +    public Object id() {
 +        return this.vertex.id();
 +    }
 +
 +    @Override
 +    public String label() {
 +        return this.vertex.label();
 +    }
 +
 +    @Override
 +    public Graph graph() {
 +        return this.vertex.graph();
 +    }
 +
 +    @Override
 +    public <V> VertexProperty<V> property(final String key, final V value) {
 +        return this.vertex.property(key, value);
 +    }
 +
 +    @Override
 +    public void remove() {
 +        this.vertex.remove();
 +    }
 +
 +    @Override
 +    public Iterators iterators() {
 +        return this;
 +    }
 +
 +    @Override
 +    public Iterator<Edge> edgeIterator(final Direction direction, final String... edgeLabels) {
 +        return this.vertex.iterators().edgeIterator(direction, edgeLabels);
 +    }
 +
 +    @Override
 +    public Iterator<Vertex> vertexIterator(final Direction direction, final String... edgeLabels) {
 +        return this.vertex.iterators().vertexIterator(direction, edgeLabels);
 +    }
 +
 +    @Override
 +    public <V> Iterator<VertexProperty<V>> propertyIterator(final String... propertyKeys) {
 +        return this.vertex.iterators().propertyIterator(propertyKeys);
 +    }
 +
 +    ///////////////////////////////
 +
 +    private void writeObject(final ObjectOutputStream outputStream) throws IOException {
 +        this.deflateVertex();
 +        outputStream.defaultWriteObject();
 +    }
 +
 +    private void readObject(final ObjectInputStream inputStream) throws IOException, ClassNotFoundException {
 +        inputStream.defaultReadObject();
 +        this.inflateVertex();
 +    }
 +
 +    private final void inflateVertex() {
 +        if (null != this.vertex)
 +            return;
 +
 +        try {
 +            final ByteArrayInputStream bis = new ByteArrayInputStream(this.vertexBytes);
 +            final TinkerGraph tinkerGraph = TinkerGraph.open();
-             KRYO_READER.readGraph(bis, tinkerGraph);
++            GRYO_READER.readGraph(bis, tinkerGraph);
 +            bis.close();
 +            this.vertexBytes = null;
 +            this.vertex = (TinkerVertex) tinkerGraph.iterators().vertexIterator(tinkerGraph.variables().get(VERTEX_ID).get()).next();
 +        } catch (final IOException e) {
 +            throw new IllegalStateException(e.getMessage(), e);
 +        }
 +    }
 +
 +    private final void deflateVertex() {
 +        if (null != this.vertexBytes)
 +            return;
 +
 +        try {
 +            final ByteArrayOutputStream bos = new ByteArrayOutputStream();
-             KRYO_WRITER.writeGraph(bos, this.vertex.graph());
++            GRYO_WRITER.writeGraph(bos, this.vertex.graph());
 +            bos.flush();
 +            bos.close();
 +            this.vertex = null;
 +            this.vertexBytes = bos.toByteArray();
 +        } catch (final IOException e) {
 +            throw new IllegalStateException(e.getMessage(), e);
 +        }
 +    }
 +}