Java Code Examples for com.esotericsoftware.kryo.Kryo.getNextRegistrationId()

The following are Jave code examples for showing how to use getNextRegistrationId() of the com.esotericsoftware.kryo.Kryo class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: athena   File:   Source Code and License Vote up 6 votes
 * Creates a Kryo instance.
 * @return Kryo instance
public Kryo create() {
    log.trace("Creating Kryo instance for {}", this);
    Kryo kryo = new Kryo();

    // TODO rethink whether we want to use StdInstantiatorStrategy
            new Kryo.DefaultInstantiatorStrategy(new StdInstantiatorStrategy()));

    for (RegistrationBlock block : registeredBlocks) {
        int id = block.begin();
        if (id == FLOATING_ID) {
            id = kryo.getNextRegistrationId();
        for (Pair<Class<?>, Serializer<?>> entry : block.types()) {
            register(kryo, entry.getLeft(), entry.getRight(), id++);
    return kryo;