Java 类com.esotericsoftware.kryo.pool.KryoFactory 实例源码
项目:assistance-platform-server
文件:KryoMessageSerialization.java
public KryoMessageSerialization() {
KryoFactory factory = new KryoFactory() {
public Kryo create() {
Kryo kryo = new Kryo();
kryo.addDefaultSerializer(UUID.class, UUIDSerializer.class);
kryo.addDefaultSerializer(Instant.class, InstantSerializer.class);
// configure kryo instance, customize settings
return kryo;
}
};
// Build pool with SoftReferences enabled (optional)
pool = new KryoPool.Builder(factory).softReferences().build();
}
项目:fluo-recipes
文件:KryoSimplerSerializer.java
private static KryoFactory getFactory(String factoryType) {
try {
return KryoSimplerSerializer.class.getClassLoader().loadClass(factoryType)
.asSubclass(KryoFactory.class).newInstance();
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
项目:spring-cloud-stream
文件:KryoMessageConverter.java
public KryoMessageConverter(List<KryoRegistrar> kryoRegistrars, boolean useReferences) {
this.useReferences = useReferences;
this.kryoRegistrar = CollectionUtils.isEmpty(kryoRegistrars) ? null :
new CompositeKryoRegistrar(kryoRegistrars);
KryoFactory factory = () -> {
Kryo kryo = new Kryo();
configureKryoInstance(kryo);
return kryo;
};
this.pool = new KryoPool.Builder(factory).softReferences().build();
this.supportedMimeTypes = Collections.singletonList(MimeType.valueOf(KRYO_MIME_TYPE));
}
项目:ratpack-examples
文件:KryoSerializerModule.java
@Provides
@Singleton
KryoPool provideKryoPool() {
KryoFactory kryoFactory = new KryoFactory() {
@Override
public Kryo create() {
Kryo kryo = new Kryo();
// configuration comes here
return kryo;
}
};
// build pool with soft references
KryoPool kryoPool = new KryoPool.Builder(kryoFactory).softReferences().build();
return kryoPool;
}
项目:reef
文件:KryoUtils.java
@Inject
private KryoUtils() {
final KryoFactory factory = new KryoFactory() {
@Override
public Kryo create() {
final Kryo kryo = new Kryo();
UnmodifiableCollectionsSerializer.registerSerializers(kryo); // Required to serialize/deserialize Throwable
return kryo;
}
};
kryoPool = new KryoPool.Builder(factory).softReferences().build();
}
项目:FKC
文件:KryoPoolQueueImpl.java
public KryoPoolQueueImpl(Queue<Kryo> queue, KryoFactory factory) {
this.queue = queue;
this.factory = factory;
}
项目:FKC
文件:KryoPool.java
public QueueBuilder(KryoFactory factory) {
if (factory == null) {
throw new IllegalArgumentException("factory must not be null");
}
this.factory = factory;
}
项目:FKC
文件:KryoPoolConfig.java
public void setKryoFactory(KryoFactory kryoFactory) {
this.kryoFactory = kryoFactory;
}
项目:FKC
文件:KryoPoolConfig.java
public KryoFactory getKryoFactory() {
return kryoFactory;
}
项目:fluo-recipes
文件:KryoSimplerSerializer.java
/**
* Can call this method to create a serializer w/o calling {@link #init(SimpleConfiguration)}
*/
public KryoSimplerSerializer(KryoFactory factory) {
factoryType = factory.getClass().getName();
this.factory = factory;
}
项目:fluo-recipes
文件:KryoSimplerSerializer.java
/**
* Call this to configure a KryoFactory type before initializing Fluo.
*/
public static void setKryoFactory(FluoConfiguration config,
Class<? extends KryoFactory> factoryType) {
config.getAppConfiguration().setProperty(KRYO_FACTORY_PROP, factoryType.getName());
}
项目:checklistbank
文件:MapDbObjectSerializer.java
public MapDbObjectSerializer(Class<T> clazz, KryoFactory kryoFactory) {
this(clazz, new KryoPool.Builder(kryoFactory).softReferences().build(), 256);
}