本文整理汇总了Java中de.javakaffee.kryoserializers.SynchronizedCollectionsSerializer类的典型用法代码示例。如果您正苦于以下问题:Java SynchronizedCollectionsSerializer类的具体用法?Java SynchronizedCollectionsSerializer怎么用?Java SynchronizedCollectionsSerializer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SynchronizedCollectionsSerializer类属于de.javakaffee.kryoserializers包,在下文中一共展示了SynchronizedCollectionsSerializer类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createKryoInstance
import de.javakaffee.kryoserializers.SynchronizedCollectionsSerializer; //导入依赖的package包/类
private Kryo createKryoInstance() {
Kryo kryo = new Kryo();
kryo.register(RakTable.class);
kryo.setDefaultSerializer(CompatibleFieldSerializer.class);
kryo.setReferences(false);
kryo.register(Collections.singletonList("").getClass(), new ArraysAsListSerializer());
UnmodifiableCollectionsSerializer.registerSerializers(kryo);
SynchronizedCollectionsSerializer.registerSerializers(kryo);
kryo.addDefaultSerializer(new ArrayList<>().subList(0, 0).getClass(), new CollectionSerializer());
kryo.addDefaultSerializer(new LinkedList<>().subList(0, 0).getClass(), new CollectionSerializer());
kryo.register(UUID.class, new UUIDSerializer());
for (Class<?> clazz : mCustomSerializers.keySet()) {
kryo.register(clazz, mCustomSerializers.get(clazz));
}
kryo.setInstantiatorStrategy(
new Kryo.DefaultInstantiatorStrategy(new StdInstantiatorStrategy()));
return kryo;
}
开发者ID:isfaaghyth,项目名称:Rak,代码行数:24,代码来源:PlainData.java
示例2: createKryoInstance
import de.javakaffee.kryoserializers.SynchronizedCollectionsSerializer; //导入依赖的package包/类
public static Kryo createKryoInstance() {
Kryo kryo = new Kryo();
// add custom serialisers to work with joda time (the kryo version that we get when including spark as a dependency cannot handle joda time by default)
// see https://github.com/magro/kryo-serializers
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 );
// custom serializers for non-jdk libs
return kryo;
}
开发者ID:olehmberg,项目名称:T2KMatch,代码行数:23,代码来源:KryoFactory.java
示例3: createKryoInstance
import de.javakaffee.kryoserializers.SynchronizedCollectionsSerializer; //导入依赖的package包/类
private Kryo createKryoInstance(boolean compatibilityMode) {
Kryo kryo = new Kryo();
if (compatibilityMode) {
kryo.getFieldSerializerConfig().setOptimizedGenerics(true);
}
kryo.register(PaperTable.class);
kryo.setDefaultSerializer(CompatibleFieldSerializer.class);
kryo.setReferences(false);
// Serialize Arrays$ArrayList
//noinspection ArraysAsListWithZeroOrOneArgument
kryo.register(Arrays.asList("").getClass(), new ArraysAsListSerializer());
UnmodifiableCollectionsSerializer.registerSerializers(kryo);
SynchronizedCollectionsSerializer.registerSerializers(kryo);
// Serialize inner AbstractList$SubAbstractListRandomAccess
kryo.addDefaultSerializer(new ArrayList<>().subList(0, 0).getClass(),
new NoArgCollectionSerializer());
// Serialize AbstractList$SubAbstractList
kryo.addDefaultSerializer(new LinkedList<>().subList(0, 0).getClass(),
new NoArgCollectionSerializer());
// To keep backward compatibility don't change the order of serializers above
// UUID support
kryo.register(UUID.class, new UUIDSerializer());
for (Class<?> clazz : mCustomSerializers.keySet())
kryo.register(clazz, mCustomSerializers.get(clazz));
kryo.setInstantiatorStrategy(
new Kryo.DefaultInstantiatorStrategy(new StdInstantiatorStrategy()));
return kryo;
}
开发者ID:pilgr,项目名称:Paper,代码行数:36,代码来源:DbStoragePlainFile.java
示例4: tryRegister
import de.javakaffee.kryoserializers.SynchronizedCollectionsSerializer; //导入依赖的package包/类
public static void tryRegister(Kryo kryo) {
kryo.register(ARRAYS_AS_LIST_CLASS, new ArraysAsListSerializer());
kryo.register(GregorianCalendar.class, new GregorianCalendarSerializer());
kryo.register(InvocationHandler.class, new JdkProxySerializer());
kryo.register(GregorianCalendar.class, new GregorianCalendarSerializer());
kryo.register(InvocationHandler.class, new JdkProxySerializer());
UnmodifiableCollectionsSerializer.registerSerializers(kryo);
SynchronizedCollectionsSerializer.registerSerializers(kryo);
}
开发者ID:hekate-io,项目名称:hekate,代码行数:12,代码来源:JavaKaffeeSerializersRegistrar.java
示例5: createKryo
import de.javakaffee.kryoserializers.SynchronizedCollectionsSerializer; //导入依赖的package包/类
/**
* Creates a new instance of Kryo serializer, for use with the given object type.
* <p/>
* Note: this method is public to allow end-users to validate compatibility of their POJOs,
* with the Kryo serializer as used by CQEngine.
*
* @param objectType The type of object which the instance of Kryo will serialize
* @return a new instance of Kryo serializer
*/
@SuppressWarnings({"ArraysAsListWithZeroOrOneArgument", "WeakerAccess"})
protected Kryo createKryo(Class<?> objectType) {
Kryo kryo = new Kryo();
// Instantiate serialized objects via a no-arg constructor when possible, falling back to Objenesis...
kryo.setInstantiatorStrategy(new Kryo.DefaultInstantiatorStrategy(new StdInstantiatorStrategy()));
// Register the object which this index will persist...
kryo.register(objectType);
// Register additional serializers which are not built-in to Kryo 3.0...
kryo.register(Arrays.asList().getClass(), new ArraysAsListSerializer());
UnmodifiableCollectionsSerializer.registerSerializers(kryo);
SynchronizedCollectionsSerializer.registerSerializers(kryo);
return kryo;
}
开发者ID:npgall,项目名称:cqengine,代码行数:23,代码来源:KryoSerializer.java
示例6: initialValue
import de.javakaffee.kryoserializers.SynchronizedCollectionsSerializer; //导入依赖的package包/类
@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;
}
开发者ID:apache,项目名称:metron,代码行数:33,代码来源:SerDeUtils.java
示例7: registerClasses
import de.javakaffee.kryoserializers.SynchronizedCollectionsSerializer; //导入依赖的package包/类
@Override
public void registerClasses(Kryo kryo) {
kryo.register(Nd4j.getBackend().getNDArrayClass(), new Nd4jSerializer());
kryo.register(Nd4j.getBackend().getComplexNDArrayClass(), new Nd4jSerializer());
kryo.register(AtomicDouble.class, new AtomicDoubleSerializer());
//Also register Java types (synchronized/unmodifiable collections), which will fail by default
UnmodifiableCollectionsSerializer.registerSerializers(kryo);
SynchronizedCollectionsSerializer.registerSerializers(kryo);
}
开发者ID:deeplearning4j,项目名称:nd4j,代码行数:11,代码来源:Nd4jRegistrator.java
示例8: initialValue
import de.javakaffee.kryoserializers.SynchronizedCollectionsSerializer; //导入依赖的package包/类
protected Kryo initialValue() {
Kryo _kryo = new KryoReflectionFactorySupport() {
@Override
@SuppressWarnings( { "rawtypes", "unchecked" } )
public Serializer<?> getDefaultSerializer( final Class type ) {
if ( EnumSet.class.isAssignableFrom( type ) ) {
return new EnumSetSerializer();
}
if ( EnumMap.class.isAssignableFrom( type ) ) {
return new EnumMapSerializer();
}
if ( Collection.class.isAssignableFrom( type ) ) {
return new CopyForIterateCollectionSerializer();
}
if ( Map.class.isAssignableFrom( type ) ) {
return new CopyForIterateMapSerializer();
}
if ( Date.class.isAssignableFrom( type ) ) {
return new DateSerializer( type );
}
return super.getDefaultSerializer( type );
}
};
_kryo.setRegistrationRequired(false);
_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( BigDecimal.class, new BigDecimalSerializer() );
_kryo.register( BigInteger.class, new 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() );
_kryo.register( GregorianCalendar.class, new GregorianCalendarSerializer() );
_kryo.register( InvocationHandler.class, new JdkProxySerializer() );
UnmodifiableCollectionsSerializer.registerSerializers( _kryo );
SynchronizedCollectionsSerializer.registerSerializers( _kryo );
// DeflateSerializer d;
// _kryo..setDefaultSerializer(CompatibleFieldSerializer.class);
return _kryo;
}
开发者ID:dawnbreaks,项目名称:NettyRPC,代码行数:47,代码来源:KryoSerializer.java
注:本文中的de.javakaffee.kryoserializers.SynchronizedCollectionsSerializer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论