Looked at the following code, it appears to be thread-safe.
Hoping to use it like
class Foo {
private static final GryoMapper MAPPER = GryoMapper.build().create();
}
instead of
class Foo {
private final GryoMapper MAPPER = GryoMapper.build().create();
}
Gryo is based on Kryo which is not thread-safe. GryoMapper
is basically just a builder for Kryo
instances which means that you should be able to initialize it as a member variable without the static
declaration. Just be sure that the Kryo
instances that you spawn from GryoMapper
are not accessed by multiple threads concurrently as described in the Kryo link provided.