本文整理了Java中com.esotericsoftware.kryo.Kryo.getInstantiatorStrategy()
方法的一些代码示例,展示了Kryo.getInstantiatorStrategy()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Kryo.getInstantiatorStrategy()
方法的具体详情如下:
包路径:com.esotericsoftware.kryo.Kryo
类名称:Kryo
方法名:getInstantiatorStrategy
暂无
代码示例来源:origin: changmingxie/tcc-transaction
public Kryo create() {
Kryo kryo = new Kryo();
kryo.setReferences(true);
kryo.setRegistrationRequired(false);
//Fix the NPE bug when deserializing Collections.
((Kryo.DefaultInstantiatorStrategy) kryo.getInstantiatorStrategy())
.setFallbackInstantiatorStrategy(new StdInstantiatorStrategy());
return kryo;
}
};
代码示例来源:origin: changmingxie/tcc-transaction
@Override
protected Kryo initialValue() {
Kryo kryo = new Kryo();
kryo.setReferences(true);
kryo.setRegistrationRequired(false);
//Fix the NPE bug when deserializing Collections.
((Kryo.DefaultInstantiatorStrategy) kryo.getInstantiatorStrategy())
.setFallbackInstantiatorStrategy(new StdInstantiatorStrategy());
return kryo;
}
};
代码示例来源:origin: changmingxie/tcc-transaction
@Override
protected Kryo initialValue() {
Kryo kryo = new Kryo();
kryo.setReferences(true);
kryo.setRegistrationRequired(false);
//Fix the NPE bug when deserializing Collections.
((Kryo.DefaultInstantiatorStrategy) kryo.getInstantiatorStrategy())
.setFallbackInstantiatorStrategy(new StdInstantiatorStrategy());
return kryo;
}
};
代码示例来源:origin: seznam/euphoria
private Kryo initKryo() {
if (this.kryo == null) {
this.kryo = new Kryo();
((Kryo.DefaultInstantiatorStrategy) kryo.getInstantiatorStrategy())
.setFallbackInstantiatorStrategy(new StdInstantiatorStrategy());
serializers.forEach((k, v) -> kryo.addDefaultSerializer(k, v.getSerializer()));
registeredClasses.forEach(kryo::register);
}
return this.kryo;
}
代码示例来源:origin: com.intoverflow.booster/booster-core
@Override
protected Kryo initialValue() {
Kryo kryo = new Kryo();
//支持对象循环引用(否则会栈溢出)
kryo.setReferences(true); //默认值就是 true,添加此行的目的是为了提醒维护者,不要改变这个配置
//不强制要求注册类(注册行为无法保证多个 JVM 内同一个类的注册编号相同;而且业务系统中大量的 Class 也难以一一注册)
kryo.setRegistrationRequired(false); //默认值就是 false,添加此行的目的是为了提醒维护者,不要改变这个配置
//Fix the NPE bug when deserializing Collections.
((Kryo.DefaultInstantiatorStrategy) kryo.getInstantiatorStrategy())
.setFallbackInstantiatorStrategy(new StdInstantiatorStrategy());
return kryo;
}
};
代码示例来源:origin: omkreddy/kafka-examples
public Kryo create() {
Kryo kryo = new Kryo();
try {
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(SINGLETON_LIST.getClass(), new CollectionsSingletonListSerializer());
kryo.register(SINGLETON_SET.getClass(), new CollectionsSingletonSetSerializer());
kryo.register(SINGLETON_MAP.getClass(), new CollectionsSingletonMapSerializer());
kryo.setRegistrationRequired(false);
UnmodifiableCollectionsSerializer.registerSerializers(kryo);
SynchronizedCollectionsSerializer.registerSerializers(kryo);
((Kryo.DefaultInstantiatorStrategy) kryo.getInstantiatorStrategy()).setFallbackInstantiatorStrategy(new StdInstantiatorStrategy());
} catch (Exception e) {
logger.error("Exception occurred", e);
}
return kryo;
}
};
内容来源于网络,如有侵权,请联系作者删除!