Skip navigation links

Package org.apache.tinkerpop.gremlin.structure.io.gryo.kryoshim

Abstracts a minimal subset of Kryo types and methods.

See: Description

Package org.apache.tinkerpop.gremlin.structure.io.gryo.kryoshim Description

Abstracts a minimal subset of Kryo types and methods.

Kryo is often shaded. For instance, TinkerPop's Gryo serializer relies on a shaded Kryo package. TinkerPop serializers written against a particular shaded Kryo package (or an unshaded Kryo package) are compatible only with that package. In contrast, TinkerPop serializers written against this abstraction can be used with any shaded or unshaded Kryo package, so long as the signatures and behavior of the methods in this package remain stable.

To show how this is useful, consider StarGraphSerializer. This class has logic unique to TinkerPop that performs efficient and forward-compatible serialization of StarGraph instances. It takes advantage of package-level visibility and the fact that it shares a package with its target, so it would be challenging to cleanly and naturally replicate (i.e. without package spoofing or runtime visibility overrides). By implementing SerializerShim instead of, say, Gryo's shaded org.apache.tinkerpop.shaded.kryo.Serializer, such a serializer can be used with anybody's Kryo package, regardless of whether that package is shaded or not. This lets third-parties reuse TinkerPop's efficient, internals-aware StarGraph serializer on their own serialization platform (and without altering TinkerPop's bytecode, let alone its source).

The number of types and methods in this package is deliberately small to reduce the likelihood of a new Kryo release introducing an incompatible change.

Skip navigation links

Copyright © 2013–2022 Apache Software Foundation. All rights reserved.