Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Updating Kryo #3593

Merged
merged 13 commits into from
Aug 24, 2020
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ maven_install(
"antlr:antlr:2.7.7",
"org.apache.zookeeper:zookeeper:3.5.8",
"io.kubernetes:client-java:" + kubernetes_client_version,
"com.esotericsoftware:kryo:3.0.3",
"com.esotericsoftware:kryo:5.0.0-RC9",
"org.apache.avro:avro:1.7.4",
"org.apache.mesos:mesos:0.22.0",
"com.hashicorp.nomad:nomad-sdk:0.7.0",
Expand Down
1 change: 1 addition & 0 deletions examples/src/java/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ java_binary(
"//heron/api/src/java:api-java-low-level",
"//heron/common/src/java:basics-java",
"//heron/simulator/src/java:simulator-java",
"//third_party/java:kryo",
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public static void main(String[] args) throws Exception {
Config conf = new Config();
conf.setDebug(true);

conf.setSerializationClassName(Config.HERON_KRYO_SERIALIZER_CLASS_NAME);

nicknezis marked this conversation as resolved.
Show resolved Hide resolved
// Specifies that all tuples will be automatically failed if not acked within 10 seconds
conf.setMessageTimeoutSecs(10);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import java.lang.reflect.InvocationTargetException;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
Expand All @@ -35,9 +34,7 @@
import com.esotericsoftware.kryo.Serializer;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;
import com.esotericsoftware.kryo.serializers.CollectionSerializer;
import com.esotericsoftware.kryo.serializers.DefaultSerializers;
import com.esotericsoftware.kryo.serializers.MapSerializer;

import org.apache.heron.api.Config;
import org.apache.heron.api.tuple.Values;
Expand Down Expand Up @@ -79,7 +76,7 @@ public void initialize(Map<String, Object> config) {

@Override
public byte[] serialize(Object object) {
kryoOut.clear();
kryoOut.reset();
kryo.writeClassAndObject(kryoOut, object);
return kryoOut.toBytes();
}
Expand All @@ -94,9 +91,9 @@ public Object deserialize(byte[] input) {
private static void registerDefaultSerializers(Kryo k) {
// Default serializers
k.register(byte[].class);
k.register(ArrayList.class, new ArrayListSerializer());
k.register(HashMap.class, new HashMapSerializer());
k.register(HashSet.class, new HashSetSerializer());
k.register(ArrayList.class);
k.register(HashMap.class);
k.register(HashSet.class);
k.register(BigInteger.class, new DefaultSerializers.BigIntegerSerializer());
k.register(Values.class);
}
Expand Down Expand Up @@ -217,28 +214,4 @@ private static Serializer resolveSerializerInstance(
String.format("Unable to create serializer \"%s\" for class: %s",
serializerClass.getName(), superClass.getName()));
}

private static class ArrayListSerializer extends CollectionSerializer {
@Override
@SuppressWarnings("rawtypes") // extending Kryo class that uses raw types
public Collection create(Kryo k, Input input, Class<Collection> type) {
return new ArrayList();
}
}

private static class HashMapSerializer extends MapSerializer {
@Override
@SuppressWarnings("rawtypes") // extending kryo class signature that takes Map
public Map<String, Object> create(Kryo k, Input input, Class<Map> type) {
return new HashMap<>();
}
}

private static class HashSetSerializer extends CollectionSerializer {
@Override
@SuppressWarnings("rawtypes") // extending Kryo class that uses raw types
public Collection create(Kryo k, Input input, Class<Collection> type) {
return new HashSet();
}
}
}
124 changes: 57 additions & 67 deletions maven_install.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"dependency_tree": {
"__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": -1332813254,
"__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": -790274667,
nicknezis marked this conversation as resolved.
Show resolved Hide resolved
"conflict_resolution": {},
"dependencies": [
{
Expand Down Expand Up @@ -374,108 +374,98 @@
"url": "https://jcenter.bintray.com/com/beust/jcommander/1.48/jcommander-1.48-sources.jar"
},
{
"coord": "com.esotericsoftware:kryo:3.0.3",
"coord": "com.esotericsoftware:kryo:5.0.0-RC9",
"dependencies": [
"com.esotericsoftware:minlog:1.3.0",
"org.objenesis:objenesis:2.1",
"org.ow2.asm:asm:5.0.4",
"com.esotericsoftware:reflectasm:1.10.1"
"com.esotericsoftware:minlog:1.3.1",
"com.esotericsoftware:reflectasm:1.11.8",
"org.objenesis:objenesis:2.1"
],
"directDependencies": [
"com.esotericsoftware:minlog:1.3.0",
"com.esotericsoftware:reflectasm:1.10.1",
"com.esotericsoftware:minlog:1.3.1",
"com.esotericsoftware:reflectasm:1.11.8",
"org.objenesis:objenesis:2.1"
],
"file": "v1/https/jcenter.bintray.com/com/esotericsoftware/kryo/3.0.3/kryo-3.0.3.jar",
"file": "v1/https/jcenter.bintray.com/com/esotericsoftware/kryo/5.0.0-RC9/kryo-5.0.0-RC9.jar",
"mirror_urls": [
"https://jcenter.bintray.com/com/esotericsoftware/kryo/3.0.3/kryo-3.0.3.jar",
"https://maven.google.com/com/esotericsoftware/kryo/3.0.3/kryo-3.0.3.jar",
"https://repo1.maven.org/maven2/com/esotericsoftware/kryo/3.0.3/kryo-3.0.3.jar"
"https://jcenter.bintray.com/com/esotericsoftware/kryo/5.0.0-RC9/kryo-5.0.0-RC9.jar",
"https://maven.google.com/com/esotericsoftware/kryo/5.0.0-RC9/kryo-5.0.0-RC9.jar",
"https://repo1.maven.org/maven2/com/esotericsoftware/kryo/5.0.0-RC9/kryo-5.0.0-RC9.jar"
],
"sha256": "5c295b23480225ff6e7d6770dfa904bedcec8556c27234fea0a271fe13195f69",
"url": "https://jcenter.bintray.com/com/esotericsoftware/kryo/3.0.3/kryo-3.0.3.jar"
"sha256": "3d9ef4b1e3c1741e5a59938b8e730b950dbed99b171103b61088cb2d66f3987d",
"url": "https://jcenter.bintray.com/com/esotericsoftware/kryo/5.0.0-RC9/kryo-5.0.0-RC9.jar"
},
{
"coord": "com.esotericsoftware:kryo:jar:sources:3.0.3",
"coord": "com.esotericsoftware:kryo:jar:sources:5.0.0-RC9",
"dependencies": [
"com.esotericsoftware:minlog:jar:sources:1.3.0",
"com.esotericsoftware:reflectasm:jar:sources:1.10.1",
"org.objenesis:objenesis:jar:sources:2.1",
"org.ow2.asm:asm:jar:sources:5.0.4"
"com.esotericsoftware:reflectasm:jar:sources:1.11.8",
"com.esotericsoftware:minlog:jar:sources:1.3.1",
"org.objenesis:objenesis:jar:sources:2.1"
],
"directDependencies": [
"com.esotericsoftware:minlog:jar:sources:1.3.0",
"com.esotericsoftware:reflectasm:jar:sources:1.10.1",
"com.esotericsoftware:minlog:jar:sources:1.3.1",
"com.esotericsoftware:reflectasm:jar:sources:1.11.8",
"org.objenesis:objenesis:jar:sources:2.1"
],
"file": "v1/https/jcenter.bintray.com/com/esotericsoftware/kryo/3.0.3/kryo-3.0.3-sources.jar",
"file": "v1/https/jcenter.bintray.com/com/esotericsoftware/kryo/5.0.0-RC9/kryo-5.0.0-RC9-sources.jar",
"mirror_urls": [
"https://jcenter.bintray.com/com/esotericsoftware/kryo/3.0.3/kryo-3.0.3-sources.jar",
"https://maven.google.com/com/esotericsoftware/kryo/3.0.3/kryo-3.0.3-sources.jar",
"https://repo1.maven.org/maven2/com/esotericsoftware/kryo/3.0.3/kryo-3.0.3-sources.jar"
"https://jcenter.bintray.com/com/esotericsoftware/kryo/5.0.0-RC9/kryo-5.0.0-RC9-sources.jar",
"https://maven.google.com/com/esotericsoftware/kryo/5.0.0-RC9/kryo-5.0.0-RC9-sources.jar",
"https://repo1.maven.org/maven2/com/esotericsoftware/kryo/5.0.0-RC9/kryo-5.0.0-RC9-sources.jar"
],
"sha256": "5a02ca261f78e21ad030e5f8ac5dc61bf93160128e53d98ef0be41dbe6dbf4a6",
"url": "https://jcenter.bintray.com/com/esotericsoftware/kryo/3.0.3/kryo-3.0.3-sources.jar"
"sha256": "c26d03e45c3840341a1e5ac953f1fa1e3c7c958eb9e129b5014cadff88663e5b",
"url": "https://jcenter.bintray.com/com/esotericsoftware/kryo/5.0.0-RC9/kryo-5.0.0-RC9-sources.jar"
},
{
"coord": "com.esotericsoftware:minlog:1.3.0",
"coord": "com.esotericsoftware:minlog:1.3.1",
"dependencies": [],
"directDependencies": [],
"file": "v1/https/jcenter.bintray.com/com/esotericsoftware/minlog/1.3.0/minlog-1.3.0.jar",
"file": "v1/https/jcenter.bintray.com/com/esotericsoftware/minlog/1.3.1/minlog-1.3.1.jar",
"mirror_urls": [
"https://jcenter.bintray.com/com/esotericsoftware/minlog/1.3.0/minlog-1.3.0.jar",
"https://maven.google.com/com/esotericsoftware/minlog/1.3.0/minlog-1.3.0.jar",
"https://repo1.maven.org/maven2/com/esotericsoftware/minlog/1.3.0/minlog-1.3.0.jar"
"https://jcenter.bintray.com/com/esotericsoftware/minlog/1.3.1/minlog-1.3.1.jar",
"https://maven.google.com/com/esotericsoftware/minlog/1.3.1/minlog-1.3.1.jar",
"https://repo1.maven.org/maven2/com/esotericsoftware/minlog/1.3.1/minlog-1.3.1.jar"
],
"sha256": "f7b399d3a5478a4f3e0d98bd1c9f47766119c66414bc33aa0f6cde0066f24cc2",
"url": "https://jcenter.bintray.com/com/esotericsoftware/minlog/1.3.0/minlog-1.3.0.jar"
"sha256": "5d4d632cfbebfe0a7644501cc303570b691406181bee65e9916b921c767d7c72",
"url": "https://jcenter.bintray.com/com/esotericsoftware/minlog/1.3.1/minlog-1.3.1.jar"
},
{
"coord": "com.esotericsoftware:minlog:jar:sources:1.3.0",
"coord": "com.esotericsoftware:minlog:jar:sources:1.3.1",
"dependencies": [],
"directDependencies": [],
"file": "v1/https/jcenter.bintray.com/com/esotericsoftware/minlog/1.3.0/minlog-1.3.0-sources.jar",
"file": "v1/https/jcenter.bintray.com/com/esotericsoftware/minlog/1.3.1/minlog-1.3.1-sources.jar",
"mirror_urls": [
"https://jcenter.bintray.com/com/esotericsoftware/minlog/1.3.0/minlog-1.3.0-sources.jar",
"https://maven.google.com/com/esotericsoftware/minlog/1.3.0/minlog-1.3.0-sources.jar",
"https://repo1.maven.org/maven2/com/esotericsoftware/minlog/1.3.0/minlog-1.3.0-sources.jar"
"https://jcenter.bintray.com/com/esotericsoftware/minlog/1.3.1/minlog-1.3.1-sources.jar",
"https://maven.google.com/com/esotericsoftware/minlog/1.3.1/minlog-1.3.1-sources.jar",
"https://repo1.maven.org/maven2/com/esotericsoftware/minlog/1.3.1/minlog-1.3.1-sources.jar"
],
"sha256": "99872e1e68874771d77bf3131620bf656b541fa993d3f6e9d29b9f03ae423d17",
"url": "https://jcenter.bintray.com/com/esotericsoftware/minlog/1.3.0/minlog-1.3.0-sources.jar"
"sha256": "fdaf83a8c51295eff3a8109473ce7b213582738f71593e16b1efa012ff1f99b5",
"url": "https://jcenter.bintray.com/com/esotericsoftware/minlog/1.3.1/minlog-1.3.1-sources.jar"
},
{
"coord": "com.esotericsoftware:reflectasm:1.10.1",
"dependencies": [
"org.ow2.asm:asm:5.0.4"
],
"directDependencies": [
"org.ow2.asm:asm:5.0.4"
],
"file": "v1/https/jcenter.bintray.com/com/esotericsoftware/reflectasm/1.10.1/reflectasm-1.10.1.jar",
"coord": "com.esotericsoftware:reflectasm:1.11.8",
"dependencies": [],
"directDependencies": [],
"file": "v1/https/jcenter.bintray.com/com/esotericsoftware/reflectasm/1.11.8/reflectasm-1.11.8.jar",
"mirror_urls": [
"https://jcenter.bintray.com/com/esotericsoftware/reflectasm/1.10.1/reflectasm-1.10.1.jar",
"https://maven.google.com/com/esotericsoftware/reflectasm/1.10.1/reflectasm-1.10.1.jar",
"https://repo1.maven.org/maven2/com/esotericsoftware/reflectasm/1.10.1/reflectasm-1.10.1.jar"
"https://jcenter.bintray.com/com/esotericsoftware/reflectasm/1.11.8/reflectasm-1.11.8.jar",
"https://maven.google.com/com/esotericsoftware/reflectasm/1.11.8/reflectasm-1.11.8.jar",
"https://repo1.maven.org/maven2/com/esotericsoftware/reflectasm/1.11.8/reflectasm-1.11.8.jar"
],
"sha256": "94867942701229aead2b99cfbfdb68ea0afe4ec6fb943e5a10cb875f6e94f5b4",
"url": "https://jcenter.bintray.com/com/esotericsoftware/reflectasm/1.10.1/reflectasm-1.10.1.jar"
"sha256": "d91dc2db686c0389763ae2253e43cfd1c7e175efcceeb3c59778d6deb86bef90",
"url": "https://jcenter.bintray.com/com/esotericsoftware/reflectasm/1.11.8/reflectasm-1.11.8.jar"
},
{
"coord": "com.esotericsoftware:reflectasm:jar:sources:1.10.1",
"dependencies": [
"org.ow2.asm:asm:jar:sources:5.0.4"
],
"directDependencies": [
"org.ow2.asm:asm:jar:sources:5.0.4"
],
"file": "v1/https/jcenter.bintray.com/com/esotericsoftware/reflectasm/1.10.1/reflectasm-1.10.1-sources.jar",
"coord": "com.esotericsoftware:reflectasm:jar:sources:1.11.8",
"dependencies": [],
"directDependencies": [],
"file": "v1/https/jcenter.bintray.com/com/esotericsoftware/reflectasm/1.11.8/reflectasm-1.11.8-sources.jar",
"mirror_urls": [
"https://jcenter.bintray.com/com/esotericsoftware/reflectasm/1.10.1/reflectasm-1.10.1-sources.jar",
"https://maven.google.com/com/esotericsoftware/reflectasm/1.10.1/reflectasm-1.10.1-sources.jar",
"https://repo1.maven.org/maven2/com/esotericsoftware/reflectasm/1.10.1/reflectasm-1.10.1-sources.jar"
"https://jcenter.bintray.com/com/esotericsoftware/reflectasm/1.11.8/reflectasm-1.11.8-sources.jar",
"https://maven.google.com/com/esotericsoftware/reflectasm/1.11.8/reflectasm-1.11.8-sources.jar",
"https://repo1.maven.org/maven2/com/esotericsoftware/reflectasm/1.11.8/reflectasm-1.11.8-sources.jar"
],
"sha256": "5d46267d7130e2d5963472dbb2a975ae764ec9f616c1c9b7e7961fcc600d38a0",
"url": "https://jcenter.bintray.com/com/esotericsoftware/reflectasm/1.10.1/reflectasm-1.10.1-sources.jar"
"sha256": "f5261244cee0661d1dc0ae4c465e13654e3ee787ce32e25e784f32b51d13ce58",
"url": "https://jcenter.bintray.com/com/esotericsoftware/reflectasm/1.11.8/reflectasm-1.11.8-sources.jar"
},
{
"coord": "com.fasterxml.jackson.core:jackson-annotations:2.8.8",
Expand Down
2 changes: 1 addition & 1 deletion release/maven/heron-with-kryo.template.pom
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<dependency>
<groupId>com.esotericsoftware</groupId>
<artifactId>kryo</artifactId>
<version>3.0.3</version>
<version>5.0.0-RC9</version>
nicknezis marked this conversation as resolved.
Show resolved Hide resolved
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void initialize(Map config) {

@Override
public byte[] serialize(Object object) {
kryoOut.clear();
kryoOut.reset();
kryo.writeClassAndObject(kryoOut, object);
return kryoOut.toBytes();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@
import com.esotericsoftware.kryo.serializers.DefaultSerializers.BigIntegerSerializer;

import backtype.storm.Config;
import backtype.storm.serialization.types.ArrayListSerializer;
import backtype.storm.serialization.types.HashMapSerializer;
import backtype.storm.serialization.types.HashSetSerializer;
import backtype.storm.tuple.Values;
import backtype.storm.utils.ListDelegate;
import backtype.storm.utils.Utils;
Expand All @@ -60,9 +57,9 @@ public static Kryo getKryo(Map conf) {
Kryo k = kryoFactory.getKryo(conf);
k.register(byte[].class);
k.register(ListDelegate.class);
k.register(ArrayList.class, new ArrayListSerializer());
k.register(HashMap.class, new HashMapSerializer());
k.register(HashSet.class, new HashSetSerializer());
k.register(ArrayList.class);
k.register(HashMap.class);
k.register(HashSet.class);
k.register(BigInteger.class, new BigIntegerSerializer());
// k.register(TransactionAttempt.class);
k.register(Values.class);
Expand Down

This file was deleted.

This file was deleted.

Loading