com.esotericsoftware.kryo.Kryo.getFieldSerializerConfig()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(163)

本文整理了Java中com.esotericsoftware.kryo.Kryo.getFieldSerializerConfig()方法的一些代码示例,展示了Kryo.getFieldSerializerConfig()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Kryo.getFieldSerializerConfig()方法的具体详情如下:
包路径:com.esotericsoftware.kryo.Kryo
类名称:Kryo
方法名:getFieldSerializerConfig

Kryo.getFieldSerializerConfig介绍

[英]The default configuration for FieldSerializer instances. Already existing serializer instances (e.g. implicitely created for already registered classes) are not affected by this configuration. You can override the configuration for a single FieldSerializer.
[中]FieldSerializer实例的默认配置。已存在的序列化程序实例(例如,为已注册的类隐式创建的实例)不受此配置的影响。您可以覆盖单个FieldSerializer的配置。

代码示例

代码示例来源:origin: magro/memcached-session-manager

protected Kryo createKryo(ClassResolver classResolver, ReferenceResolver referenceResolver, StreamFactory streamFactory) {
  Kryo kryo = new Kryo(classResolver, referenceResolver, streamFactory);
  // Maintain Kryo compatibility (pre version 4) - can turn this off by calling withOptimizedGenerics(false) 
  kryo.getFieldSerializerConfig().setOptimizedGenerics(true);
  return kryo;
}

代码示例来源:origin: magro/memcached-session-manager

@Override
  public Kryo build() {
    Kryo k = this.buildFrom(KryoBuilder.this);
    k.getFieldSerializerConfig().setOptimizedGenerics(optimizedGenerics);
    return k;
  }
};

代码示例来源:origin: com.esotericsoftware/kryo

public FieldSerializer (Kryo kryo, Class type, Class[] generics) {
  this(kryo, type, generics, kryo.getFieldSerializerConfig().clone());
}

代码示例来源:origin: com.esotericsoftware/kryo-shaded

public FieldSerializer (Kryo kryo, Class type, Class[] generics) {
  this(kryo, type, generics, kryo.getFieldSerializerConfig().clone());
}

代码示例来源:origin: dremio/dremio-oss

/**
 * Returns a new {@link LogicalPlanDeserializer}
 * @param cluster cluster to inject during deserialization
 * @param catalog catalog used during deserializing tables
 * @param registry registry used during deserializing storage plugins
 */
public static LogicalPlanDeserializer forDeserialization(final RelOptCluster cluster, final DremioCatalogReader catalog) {
 final Kryo kryo = new Kryo();
 kryo.getFieldSerializerConfig().setUseAsm(true);
 final KryoRelSerializer serializer = KryoRelSerializer.newBuilder(kryo, cluster, catalog).build();
 return new LogicalPlanDeserializer() {
  @Override
  public RelNode deserialize(final byte[] data) {
   try {
    return serializer.deserialize(data);
   } catch (Throwable e) {
    throw new KryoDeserializationException(e);
   }
  }
  @Override
  public RelNode deserialize(String data) {
   throw UserException.unsupportedError().message("Kryo serializer doesn't support deserialization from JSON.").build(logger);
  }
 };
}

相关文章