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 forKryo
instances which means that you should be able to initialize it as a member variable without thestatic
declaration. Just be sure that theKryo
instances that you spawn fromGryoMapper
are not accessed by multiple threads concurrently as described in the Kryo link provided.