为什么Flink在运行时采用的是ChildFirstClassLoader?为什么没有采用默认的双亲模式?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

为什么Flink在运行时采用的是ChildFirstClassLoader?为什么没有采用默认的双亲模式?

徐涛
Hi All,
      看了Flink源代码,发现在实际运行的时候采用的是ChildFirstClassLoader,破坏了双亲模式,请问为什么采用这种设计,是有什么考虑吗?


谢谢
徐涛
Reply | Threaded
Open this post in threaded view
|

Re:为什么Flink在运行时采用的是ChildFirstClassLoader?为什么没有采用默认的双亲模式?

hongton122

The benefit of inverted classloading is that jobs can use different library versions than Flink’s core itself, which is very useful when the different versions of the libraries are not compatible. The mechanism helps to avoid the common dependency conflict errors like IllegalAccessError or NoSuchMethodError. Different parts of the code simply have separate copies of the classes (Flink’s core or one of its dependencies can use a different copy than the user code). In most cases, this works well and no additional configuration from the user is needed

You can find some details at https://ci.apache.org/projects/flink/flink-docs-master/monitoring/debugging_classloading.html, maybe it will help you.




在 2019-07-13 22:50:42,"徐涛" <[hidden email]> 写道:
>Hi All,
>      看了Flink源代码,发现在实际运行的时候采用的是ChildFirstClassLoader,破坏了双亲模式,请问为什么采用这种设计,是有什么考虑吗?
>
>
>谢谢
>徐涛
Reply | Threaded
Open this post in threaded view
|

Re:为什么Flink在运行时采用的是ChildFirstClassLoader?为什么没有采用默认的双亲模式?

hongton122
In reply to this post by 徐涛



The benefit of inverted classloading is that jobs can use different library versions than Flink’s core itself, which is very useful when the different versions of the libraries are not compatible. The mechanism helps to avoid the common dependency conflict errors like IllegalAccessError or NoSuchMethodError. Different parts of the code simply have separate copies of the classes (Flink’s core or one of its dependencies can use a different copy than the user code). In most cases, this works well and no additional configuration from the user is needed

You can find some details at https://ci.apache.org/projects/flink/flink-docs-master/monitoring/debugging_classloading.html, maybe it will help you.





在 2019-07-13 22:50:42,"徐涛" <[hidden email]> 写道:
>Hi All,
>      看了Flink源代码,发现在实际运行的时候采用的是ChildFirstClassLoader,破坏了双亲模式,请问为什么采用这种设计,是有什么考虑吗?
>
>
>谢谢
>徐涛