com.esotericsoftware.kryo.pool.KryoFactory Java Examples

The following examples show how to use com.esotericsoftware.kryo.pool.KryoFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KryoSerializerFactory.java    From Thunder with Apache License 2.0 5 votes vote down vote up
public static KryoPool createPool(final int maxDepth) {
    return new KryoPool.Builder(new KryoFactory() {
        @Override
        public Kryo create() {
            return createKryo(maxDepth);
        }
    }).softReferences().build();
}
 
Example #2
Source File: KryoUtils.java    From reef with Apache License 2.0 5 votes vote down vote up
@Inject
private KryoUtils() {
  final KryoFactory factory = new KryoFactory() {
    @Override
    public Kryo create() {
      final Kryo kryo = new Kryo();
      UnmodifiableCollectionsSerializer.registerSerializers(kryo); // Required to serialize/deserialize Throwable
      return kryo;
    }
  };
  kryoPool = new KryoPool.Builder(factory).softReferences().build();
}