com.twitter.chill.java.Java8ClosureRegistrar Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spark-core Show documentation
Show all versions of spark-core Show documentation
Shaded version of Apache Spark 2.x.x for Presto
The newest version!
package com.twitter.chill.java;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.serializers.ClosureSerializer;
import com.twitter.chill.IKryoRegistrar;
/**
* Enables Java 8 lambda serialization if running on Java 8; no-op otherwise.
*/
public class Java8ClosureRegistrar implements IKryoRegistrar {
@Override
public void apply(Kryo k) {
try {
Class.forName("java.lang.invoke.SerializedLambda");
} catch (ClassNotFoundException e) {
// Not running on Java 8.
return;
}
k.register(ClosureSerializer.Closure.class, new ClosureSerializer());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy