All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.nedap.archie.util.KryoUtil Maven / Gradle / Ivy

The newest version!
package com.nedap.archie.util;

import com.esotericsoftware.kryo.kryo5.Kryo;
import com.esotericsoftware.kryo.kryo5.util.Pool;
import com.nedap.archie.kryo.URISerializer;

import java.net.URI;

/**
 * Created by pieter.bos on 03/11/15.
 */
public class KryoUtil {

    // Build pool with SoftReferences enabled (optional)
    private static Pool pool;

    static {
        // Pool constructor arguments: thread safe, soft references, maximum capacity
        pool = new Pool(true, false) {
            protected Kryo create () {
                Kryo kryo = new Kryo();
                kryo.setRegistrationRequired(false);
                kryo.setReferences(true);
                kryo.setCopyReferences(true);
                kryo.addDefaultSerializer(URI.class, URISerializer.class);
                return kryo;
            }
        };

    }

    public static Pool getPool() {
        return pool;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy