Search in sources :

Example 1 with BitSetSerializer

use of de.javakaffee.kryoserializers.BitSetSerializer in project dubbo by alibaba.

the class AbstractKryoFactory method create.

public Kryo create() {
    if (!kryoCreated) {
        kryoCreated = true;
    }
    Kryo kryo = new CompatibleKryo();
    // TODO
    // kryo.setReferences(false);
    kryo.setRegistrationRequired(registrationRequired);
    kryo.register(Arrays.asList("").getClass(), new ArraysAsListSerializer());
    kryo.register(GregorianCalendar.class, new GregorianCalendarSerializer());
    kryo.register(InvocationHandler.class, new JdkProxySerializer());
    kryo.register(BigDecimal.class, new DefaultSerializers.BigDecimalSerializer());
    kryo.register(BigInteger.class, new DefaultSerializers.BigIntegerSerializer());
    kryo.register(Pattern.class, new RegexSerializer());
    kryo.register(BitSet.class, new BitSetSerializer());
    kryo.register(URI.class, new URISerializer());
    kryo.register(UUID.class, new UUIDSerializer());
    UnmodifiableCollectionsSerializer.registerSerializers(kryo);
    SynchronizedCollectionsSerializer.registerSerializers(kryo);
    // now just added some very common classes
    // TODO optimization
    kryo.register(HashMap.class);
    kryo.register(ArrayList.class);
    kryo.register(LinkedList.class);
    kryo.register(HashSet.class);
    kryo.register(TreeSet.class);
    kryo.register(Hashtable.class);
    kryo.register(Date.class);
    kryo.register(Calendar.class);
    kryo.register(ConcurrentHashMap.class);
    kryo.register(SimpleDateFormat.class);
    kryo.register(GregorianCalendar.class);
    kryo.register(Vector.class);
    kryo.register(BitSet.class);
    kryo.register(StringBuffer.class);
    kryo.register(StringBuilder.class);
    kryo.register(Object.class);
    kryo.register(Object[].class);
    kryo.register(String[].class);
    kryo.register(byte[].class);
    kryo.register(char[].class);
    kryo.register(int[].class);
    kryo.register(float[].class);
    kryo.register(double[].class);
    for (Class clazz : registrations) {
        kryo.register(clazz);
    }
    for (Class clazz : SerializableClassRegistry.getRegisteredClasses()) {
        kryo.register(clazz);
    }
    return kryo;
}
Also used : JdkProxySerializer(de.javakaffee.kryoserializers.JdkProxySerializer) DefaultSerializers(com.esotericsoftware.kryo.serializers.DefaultSerializers) GregorianCalendarSerializer(de.javakaffee.kryoserializers.GregorianCalendarSerializer) CompatibleKryo(com.alibaba.dubbo.common.serialize.kryo.CompatibleKryo) RegexSerializer(de.javakaffee.kryoserializers.RegexSerializer) URISerializer(de.javakaffee.kryoserializers.URISerializer) UUIDSerializer(de.javakaffee.kryoserializers.UUIDSerializer) ArraysAsListSerializer(de.javakaffee.kryoserializers.ArraysAsListSerializer) Kryo(com.esotericsoftware.kryo.Kryo) CompatibleKryo(com.alibaba.dubbo.common.serialize.kryo.CompatibleKryo) BitSetSerializer(de.javakaffee.kryoserializers.BitSetSerializer)

Aggregations

CompatibleKryo (com.alibaba.dubbo.common.serialize.kryo.CompatibleKryo)1 Kryo (com.esotericsoftware.kryo.Kryo)1 DefaultSerializers (com.esotericsoftware.kryo.serializers.DefaultSerializers)1 ArraysAsListSerializer (de.javakaffee.kryoserializers.ArraysAsListSerializer)1 BitSetSerializer (de.javakaffee.kryoserializers.BitSetSerializer)1 GregorianCalendarSerializer (de.javakaffee.kryoserializers.GregorianCalendarSerializer)1 JdkProxySerializer (de.javakaffee.kryoserializers.JdkProxySerializer)1 RegexSerializer (de.javakaffee.kryoserializers.RegexSerializer)1 URISerializer (de.javakaffee.kryoserializers.URISerializer)1 UUIDSerializer (de.javakaffee.kryoserializers.UUIDSerializer)1