Class KryoInstantiator

java.lang.Object
com.twitter.chill.KryoInstantiator
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ConfiguredInstantiator, ReflectingInstantiator

public class KryoInstantiator extends Object implements Serializable
Class to create a new Kryo instance. Used in initial configuration or pooling of Kryo objects. These objects are immutable (and hopefully Kryo serializable)
See Also:
  • Constructor Details

    • KryoInstantiator

      public KryoInstantiator()
  • Method Details

    • newKryo

      public com.esotericsoftware.kryo.kryo5.Kryo newKryo()
    • setClassLoader

      public KryoInstantiator setClassLoader(ClassLoader cl)
      Use this to set a specific classloader
    • setInstantiatorStrategy

      public KryoInstantiator setInstantiatorStrategy(com.esotericsoftware.kryo.kryo5.objenesis.strategy.InstantiatorStrategy inst)
      If true, Kryo will error if it sees a class that has not been registered
    • setReferences

      public KryoInstantiator setReferences(boolean ref)
      If true, Kryo keeps a map of all the objects it has seen. this can use a ton of memory on hadoop, but save serialization costs in some cases
    • setRegistrationRequired

      public KryoInstantiator setRegistrationRequired(boolean req)
      If true, Kryo will error if it sees a class that has not been registered
    • setThreadContextClassLoader

      public KryoInstantiator setThreadContextClassLoader()
      Use Thread.currentThread().getContextClassLoader() as the ClassLoader where ther newKryo is called
    • withRegistrar

      public KryoInstantiator withRegistrar(IKryoRegistrar r)