Re: Objects deserialization on Jobmanager
Posted by
Stephan Ewen on
URL: http://deprecated-apache-flink-user-mailing-list-archive.369.s1.nabble.com/Objects-deserialization-on-Jobmanager-tp1104p1107.html
Hi Ventura!
Flink loads on startup only the Flink classes and all user code classes are loaded dynamically. Each point when a user class is used, or a user class object is deserialized, Flink uses the user code classloader of that specific job.
For you as the user, this has the implication that if try to load a class via "Class.forName", you need to supply the user code classloader as well.
You can grab the usercode class loader in various ways:
1) Inside a UDF, you can grab it by making this a RichFunction and using "getRuntimeContext().getUsercodeClassloader()"
2) At almost any other play, you can use "Thread.currentThread().getContextClassloader()"
Hope that helps.
Greetings,
Stephan