beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stasle...@apache.org
Subject [1/2] beam git commit: Added a specific signature so that Kryo doesn't have to look for it using reflective exploration.
Date Thu, 30 Mar 2017 12:03:03 GMT
Repository: beam
Updated Branches:
  refs/heads/master 2a40534e8 -> 22d368b40


Added a specific signature so that Kryo doesn't have to look for it using reflective exploration.


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

Branch: refs/heads/master
Commit: 1a02c60032f5733a6b2bae8a5853864fea86c035
Parents: 2a40534
Author: Stas Levin <staslevin@apache.org>
Authored: Wed Mar 29 15:33:17 2017 +0300
Committer: Stas Levin <staslevin@apache.org>
Committed: Thu Mar 30 15:00:43 2017 +0300

----------------------------------------------------------------------
 .../runners/spark/coders/StatelessJavaSerializer.java    | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/beam/blob/1a02c600/runners/spark/src/main/java/org/apache/beam/runners/spark/coders/StatelessJavaSerializer.java
----------------------------------------------------------------------
diff --git a/runners/spark/src/main/java/org/apache/beam/runners/spark/coders/StatelessJavaSerializer.java
b/runners/spark/src/main/java/org/apache/beam/runners/spark/coders/StatelessJavaSerializer.java
index b29cf0c..01b3b93 100644
--- a/runners/spark/src/main/java/org/apache/beam/runners/spark/coders/StatelessJavaSerializer.java
+++ b/runners/spark/src/main/java/org/apache/beam/runners/spark/coders/StatelessJavaSerializer.java
@@ -54,6 +54,17 @@ import java.io.ObjectStreamClass;
  * </p>
  */
 class StatelessJavaSerializer extends Serializer {
+
+  // Since Kryo uses reflection to sequentially look for constructor signatures, starting
+  // with this particular signature spares exploring further ones, which involves
+  // NoSuchMethodException(s) being thrown as part of the exploration process and may slow
+  // things down, see Kryo#newSerializer(), see https://goo.gl/Jn425G
+  public StatelessJavaSerializer(final Kryo ignore1, final Class<?> ignore2) {}
+
+  public StatelessJavaSerializer() {
+    this(null, null);
+  }
+
   @SuppressWarnings("unchecked")
   public void write(Kryo kryo, Output output, Object object) {
     try {


Mime
View raw message