diff --git a/flink-core/src/main/java/org/apache/flink/api/java/typeutils/AvroUtils.java b/flink-core/src/main/java/org/apache/flink/api/java/typeutils/AvroUtils.java index 2983be0a7cf7e044e51c4fbe467741f6707a2779..0677338b7b2b9e43bf0262761c261969c4074b19 100644 --- a/flink-core/src/main/java/org/apache/flink/api/java/typeutils/AvroUtils.java +++ b/flink-core/src/main/java/org/apache/flink/api/java/typeutils/AvroUtils.java @@ -37,12 +37,14 @@ public abstract class AvroUtils { private static final String AVRO_KRYO_UTILS = "org.apache.flink.formats.avro.utils.AvroKryoSerializerUtils"; - private static final AvroUtils INSTANCE = loadAvroKryoUtils(); - - private static AvroUtils loadAvroKryoUtils() { + /** + * Returns either the default {@link AvroUtils} which throw an exception in cases where Avro + * would be needed or loads the specific utils for Avro from flink-avro. + */ + public static AvroUtils getAvroUtils() { // try and load the special AvroUtils from the flink-avro package try { - Class clazz = Class.forName(AVRO_KRYO_UTILS, false, AvroUtils.class.getClassLoader()); + Class clazz = Class.forName(AVRO_KRYO_UTILS, false, Thread.currentThread().getContextClassLoader()); return clazz.asSubclass(AvroUtils.class).getConstructor().newInstance(); } catch (ClassNotFoundException e) { // cannot find the utils, return the default implementation @@ -52,14 +54,6 @@ public abstract class AvroUtils { } } - /** - * Returns either the default {@link AvroUtils} which throw an exception in cases where Avro - * would be needed or loads the specific utils for Avro from flink-avro. - */ - public static AvroUtils getAvroUtils() { - return INSTANCE; - } - // ------------------------------------------------------------------------ /** diff --git a/flink-dist/pom.xml b/flink-dist/pom.xml index ed8314d5f3dd742983c53deaada7bf164651d7e2..5d63b42cdde8bc605e63f115e08abfdfd19f26dc 100644 --- a/flink-dist/pom.xml +++ b/flink-dist/pom.xml @@ -79,12 +79,6 @@ under the License. ${project.version} - - org.apache.flink - flink-avro - ${project.version} - - org.apache.flink flink-streaming-java_${scala.binary.version} @@ -492,10 +486,6 @@ under the License. - - org.codehaus.jackson - org.apache.flink.formats.avro.shaded.org.codehaus.jackson - com.fasterxml.jackson