de.javakaffee.kryoserializers.CollectionsSingletonMapSerializer Java Examples
The following examples show how to use
de.javakaffee.kryoserializers.CollectionsSingletonMapSerializer.
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: KryoSerialization.java From JPPF with Apache License 2.0 | 6 votes |
/** * Create a Kryo instance, with its instantiator strategy and a set of * common serializers (from kryo-serializers project) initialized. * @return an instance of {@link Kryo}. */ private static Kryo createKryo() { final Kryo kryo = new Kryo(new CustomClassResolver(), new MapReferenceResolver()); kryo.setAutoReset(true); kryo.setInstantiatorStrategy(new DefaultInstantiatorStrategy(new StdInstantiatorStrategy())); kryo.register(ObjectName.class, new ObjectNameSerializer()); kryo.register(OffloadableNotification.class, new GenericObjectSerializer()); kryo.register(TaskExecutionNotification.class, new GenericObjectSerializer()); kryo.register(TaskGraph.class, new JobTaskGraphSerializer()); kryo.register(Collection.class, new CollectionSerializer()); kryo.register(Arrays.asList( "" ).getClass(), new ArraysAsListSerializer() ); kryo.register(Collections.EMPTY_LIST.getClass(), new CollectionsEmptyListSerializer() ); kryo.register(Collections.EMPTY_MAP.getClass(), new CollectionsEmptyMapSerializer() ); kryo.register(Collections.EMPTY_SET.getClass(), new CollectionsEmptySetSerializer() ); kryo.register(Collections.singletonList( "" ).getClass(), new CollectionsSingletonListSerializer() ); kryo.register(Collections.singleton( "" ).getClass(), new CollectionsSingletonSetSerializer() ); kryo.register(Collections.singletonMap( "", "" ).getClass(), new CollectionsSingletonMapSerializer() ); kryo.register(GregorianCalendar.class, new GregorianCalendarSerializer()); kryo.register(InvocationHandler.class, new JdkProxySerializer()); UnmodifiableCollectionsSerializer.registerSerializers(kryo); SynchronizedCollectionsSerializer.registerSerializers(kryo); kryo.register(EnumMap.class, new EnumMapSerializer()); kryo.register(EnumSet.class, new EnumSetSerializer()); return kryo; }
Example #2
Source File: Kryos.java From ache with Apache License 2.0 | 5 votes |
private static void registerDeserializers(Kryo kryo) { // register deserializers for java collections that are not available by default kryo.register(Arrays.asList("").getClass(), new ArraysAsListSerializer()); kryo.register(Arrays.asList("").getClass(), new ArraysAsListSerializer()); kryo.register(Collections.EMPTY_LIST.getClass(), new CollectionsEmptyListSerializer()); kryo.register(Collections.EMPTY_MAP.getClass(), new CollectionsEmptyMapSerializer()); kryo.register(Collections.EMPTY_SET.getClass(), new CollectionsEmptySetSerializer()); kryo.register(Collections.singletonList("").getClass(), new CollectionsSingletonListSerializer()); kryo.register(Collections.singleton("").getClass(), new CollectionsSingletonSetSerializer()); kryo.register(Collections.singletonMap("", "").getClass(), new CollectionsSingletonMapSerializer()); }
Example #3
Source File: SerDeUtils.java From metron with Apache License 2.0 | 5 votes |
@Override protected Kryo initialValue() { Kryo ret = new Kryo(); ret.setReferences(true); ret.setInstantiatorStrategy(new DefaultInstantiatorStrategy(new StdInstantiatorStrategy())); ret.register(Arrays.asList("").getClass(), new ArraysAsListSerializer()); ret.register(Collections.EMPTY_LIST.getClass(), new CollectionsEmptyListSerializer()); ret.register(Collections.EMPTY_MAP.getClass(), new CollectionsEmptyMapSerializer()); ret.register(Collections.EMPTY_SET.getClass(), new CollectionsEmptySetSerializer()); ret.register(Collections.singletonList("").getClass(), new CollectionsSingletonListSerializer()); ret.register(Collections.singleton("").getClass(), new CollectionsSingletonSetSerializer()); ret.register(Collections.singletonMap("", "").getClass(), new CollectionsSingletonMapSerializer()); ret.register(GregorianCalendar.class, new GregorianCalendarSerializer()); ret.register(InvocationHandler.class, new JdkProxySerializer()); UnmodifiableCollectionsSerializer.registerSerializers(ret); SynchronizedCollectionsSerializer.registerSerializers(ret); // custom serializers for non-jdk libs // register CGLibProxySerializer, works in combination with the appropriate action in handleUnregisteredClass (see below) ret.register(CGLibProxySerializer.CGLibProxyMarker.class, new CGLibProxySerializer()); // joda DateTime, LocalDate and LocalDateTime ret.register(LocalDate.class, new JodaLocalDateSerializer()); ret.register(LocalDateTime.class, new JodaLocalDateTimeSerializer()); // guava ImmutableList, ImmutableSet, ImmutableMap, ImmutableMultimap, UnmodifiableNavigableSet ImmutableListSerializer.registerSerializers(ret); ImmutableSetSerializer.registerSerializers(ret); ImmutableMapSerializer.registerSerializers(ret); ImmutableMultimapSerializer.registerSerializers(ret); return ret; }
Example #4
Source File: SerDeUtils.java From metron with Apache License 2.0 | 5 votes |
@Override protected Kryo initialValue() { Kryo ret = new Kryo(); ret.setReferences(true); ret.setInstantiatorStrategy(new DefaultInstantiatorStrategy(new StdInstantiatorStrategy())); ret.register(Arrays.asList("").getClass(), new ArraysAsListSerializer()); ret.register(Collections.EMPTY_LIST.getClass(), new CollectionsEmptyListSerializer()); ret.register(Collections.EMPTY_MAP.getClass(), new CollectionsEmptyMapSerializer()); ret.register(Collections.EMPTY_SET.getClass(), new CollectionsEmptySetSerializer()); ret.register(Collections.singletonList("").getClass(), new CollectionsSingletonListSerializer()); ret.register(Collections.singleton("").getClass(), new CollectionsSingletonSetSerializer()); ret.register(Collections.singletonMap("", "").getClass(), new CollectionsSingletonMapSerializer()); ret.register(GregorianCalendar.class, new GregorianCalendarSerializer()); ret.register(InvocationHandler.class, new JdkProxySerializer()); UnmodifiableCollectionsSerializer.registerSerializers(ret); SynchronizedCollectionsSerializer.registerSerializers(ret); // custom serializers for non-jdk libs // register CGLibProxySerializer, works in combination with the appropriate action in handleUnregisteredClass (see below) ret.register(CGLibProxySerializer.CGLibProxyMarker.class, new CGLibProxySerializer()); // joda DateTime, LocalDate and LocalDateTime ret.register(LocalDate.class, new JodaLocalDateSerializer()); ret.register(LocalDateTime.class, new JodaLocalDateTimeSerializer()); // guava ImmutableList, ImmutableSet, ImmutableMap, ImmutableMultimap, UnmodifiableNavigableSet ImmutableListSerializer.registerSerializers(ret); ImmutableSetSerializer.registerSerializers(ret); ImmutableMapSerializer.registerSerializers(ret); ImmutableMultimapSerializer.registerSerializers(ret); return ret; }