/** * Adds a new Kryo default serializer to the Runtime. * * <p>Note that the serializer instance must be serializable (as defined by java.io.Serializable), * because it may be distributed to the worker nodes by java serialization. * * @param type The class of the types serialized with the given serializer. * @param serializer The serializer to use. */ public <T extends Serializer<?> & Serializable>void addDefaultKryoSerializer(Class<?> type, T serializer) { config.addDefaultKryoSerializer(type, serializer); }
/** * Adds a new Kryo default serializer to the Runtime. * * @param type * The class of the types serialized with the given serializer. * @param serializerClass * The class of the serializer to use. */ public void addDefaultKryoSerializer(Class<?> type, Class<? extends Serializer<?>> serializerClass) { config.addDefaultKryoSerializer(type, serializerClass); }
/** * Adds a new Kryo default serializer to the Runtime. * * @param type The class of the types serialized with the given serializer. * @param serializerClass The class of the serializer to use. */ public void addDefaultKryoSerializer(Class<?> type, Class<? extends Serializer<?>> serializerClass) { config.addDefaultKryoSerializer(type, serializerClass); }
/** * Adds a new Kryo default serializer to the Runtime. * * <p>Note that the serializer instance must be serializable (as defined by * java.io.Serializable), because it may be distributed to the worker nodes * by java serialization. * * @param type * The class of the types serialized with the given serializer. * @param serializer * The serializer to use. */ public <T extends Serializer<?> & Serializable>void addDefaultKryoSerializer(Class<?> type, T serializer) { config.addDefaultKryoSerializer(type, serializer); }
@Override public void addAvroSerializersIfRequired(ExecutionConfig reg, Class<?> type) { if (org.apache.avro.specific.SpecificRecordBase.class.isAssignableFrom(type) || org.apache.avro.generic.GenericData.Record.class.isAssignableFrom(type)) { // Avro POJOs contain java.util.List which have GenericData.Array as their runtime type // because Kryo is not able to serialize them properly, we use this serializer for them reg.registerTypeWithKryoSerializer(GenericData.Array.class, Serializers.SpecificInstanceCollectionSerializerForArrayList.class); // We register this serializer for users who want to use untyped Avro records (GenericData.Record). // Kryo is able to serialize everything in there, except for the Schema. // This serializer is very slow, but using the GenericData.Records of Kryo is in general a bad idea. // we add the serializer as a default serializer because Avro is using a private sub-type at runtime. reg.addDefaultKryoSerializer(Schema.class, AvroSchemaSerializer.class); } }
@Test public void testDuplicateSerializerWithDefaultSerializerClass() { ExecutionConfig executionConfig = new ExecutionConfig(); executionConfig.addDefaultKryoSerializer(WrappedString.class, TestSerializer.class); runDuplicateSerializerTest(executionConfig); }
@Test public void testDuplicateSerializerWithDefaultSerializerInstance() { ExecutionConfig executionConfig = new ExecutionConfig(); executionConfig.addDefaultKryoSerializer(WrappedString.class, new TestSerializer()); runDuplicateSerializerTest(executionConfig); }
/** * Adds a new Kryo default serializer to the Runtime. * * @param type The class of the types serialized with the given serializer. * @param serializerClass The class of the serializer to use. */ public void addDefaultKryoSerializer(Class<?> type, Class<? extends Serializer<?>> serializerClass) { config.addDefaultKryoSerializer(type, serializerClass); }
/** * Adds a new Kryo default serializer to the Runtime. * * @param type * The class of the types serialized with the given serializer. * @param serializerClass * The class of the serializer to use. */ public void addDefaultKryoSerializer(Class<?> type, Class<? extends Serializer<?>> serializerClass) { config.addDefaultKryoSerializer(type, serializerClass); }
/** * Adds a new Kryo default serializer to the Runtime. * * @param type * The class of the types serialized with the given serializer. * @param serializerClass * The class of the serializer to use. */ public void addDefaultKryoSerializer(Class<?> type, Class<? extends Serializer<?>> serializerClass) { config.addDefaultKryoSerializer(type, serializerClass); }
/** * Adds a new Kryo default serializer to the Runtime. * * <p>Note that the serializer instance must be serializable (as defined by java.io.Serializable), * because it may be distributed to the worker nodes by java serialization. * * @param type The class of the types serialized with the given serializer. * @param serializer The serializer to use. */ public <T extends Serializer<?> & Serializable>void addDefaultKryoSerializer(Class<?> type, T serializer) { config.addDefaultKryoSerializer(type, serializer); }
/** * Adds a new Kryo default serializer to the Runtime. * * @param type The class of the types serialized with the given serializer. * @param serializerClass The class of the serializer to use. */ public void addDefaultKryoSerializer(Class<?> type, Class<? extends Serializer<?>> serializerClass) { config.addDefaultKryoSerializer(type, serializerClass); }
/** * Adds a new Kryo default serializer to the Runtime. * * @param type * The class of the types serialized with the given serializer. * @param serializerClass * The class of the serializer to use. */ public void addDefaultKryoSerializer(Class<?> type, Class<? extends Serializer<?>> serializerClass) { config.addDefaultKryoSerializer(type, serializerClass); }
/** * Adds a new Kryo default serializer to the Runtime. * * <p>Note that the serializer instance must be serializable (as defined by java.io.Serializable), * because it may be distributed to the worker nodes by java serialization. * * @param type The class of the types serialized with the given serializer. * @param serializer The serializer to use. */ public <T extends Serializer<?> & Serializable>void addDefaultKryoSerializer(Class<?> type, T serializer) { config.addDefaultKryoSerializer(type, serializer); }
/** * Adds a new Kryo default serializer to the Runtime. * * <p>Note that the serializer instance must be serializable (as defined by java.io.Serializable), * because it may be distributed to the worker nodes by java serialization. * * @param type The class of the types serialized with the given serializer. * @param serializer The serializer to use. */ public <T extends Serializer<?> & Serializable>void addDefaultKryoSerializer(Class<?> type, T serializer) { config.addDefaultKryoSerializer(type, serializer); }
/** * Adds a new Kryo default serializer to the Runtime. * * @param type * The class of the types serialized with the given serializer. * @param serializerClass * The class of the serializer to use. */ public void addDefaultKryoSerializer(Class<?> type, Class<? extends Serializer<?>> serializerClass) { config.addDefaultKryoSerializer(type, serializerClass); }
/** * Adds a new Kryo default serializer to the Runtime. * * @param type The class of the types serialized with the given serializer. * @param serializerClass The class of the serializer to use. */ public void addDefaultKryoSerializer(Class<?> type, Class<? extends Serializer<?>> serializerClass) { config.addDefaultKryoSerializer(type, serializerClass); }
/** * Adds a new Kryo default serializer to the Runtime. * * <p>Note that the serializer instance must be serializable (as defined by * java.io.Serializable), because it may be distributed to the worker nodes * by java serialization. * * @param type * The class of the types serialized with the given serializer. * @param serializer * The serializer to use. */ public <T extends Serializer<?> & Serializable>void addDefaultKryoSerializer(Class<?> type, T serializer) { config.addDefaultKryoSerializer(type, serializer); }
@Override public void addAvroSerializersIfRequired(ExecutionConfig reg, Class<?> type) { if (org.apache.avro.specific.SpecificRecordBase.class.isAssignableFrom(type) || org.apache.avro.generic.GenericData.Record.class.isAssignableFrom(type)) { // Avro POJOs contain java.util.List which have GenericData.Array as their runtime type // because Kryo is not able to serialize them properly, we use this serializer for them reg.registerTypeWithKryoSerializer(GenericData.Array.class, Serializers.SpecificInstanceCollectionSerializerForArrayList.class); // We register this serializer for users who want to use untyped Avro records (GenericData.Record). // Kryo is able to serialize everything in there, except for the Schema. // This serializer is very slow, but using the GenericData.Records of Kryo is in general a bad idea. // we add the serializer as a default serializer because Avro is using a private sub-type at runtime. reg.addDefaultKryoSerializer(Schema.class, AvroSchemaSerializer.class); } }
@Override public void addAvroSerializersIfRequired(ExecutionConfig reg, Class<?> type) { if (org.apache.avro.specific.SpecificRecordBase.class.isAssignableFrom(type) || GenericData.Record.class.isAssignableFrom(type)) { // Avro POJOs contain java.util.List which have GenericData.Array as their runtime type // because Kryo is not able to serialize them properly, we use this serializer for them reg.registerTypeWithKryoSerializer(GenericData.Array.class, Serializers.SpecificInstanceCollectionSerializerForArrayList.class); // We register this serializer for users who want to use untyped Avro records (GenericData.Record). // Kryo is able to serialize everything in there, except for the Schema. // This serializer is very slow, but using the GenericData.Records of Kryo is in general a bad idea. // we add the serializer as a default serializer because Avro is using a private sub-type at runtime. reg.addDefaultKryoSerializer(Schema.class, AvroSchemaSerializer.class); } }