sijie commented on a change in pull request #5357: [functions][Issue:5350]Fix 
pulsar can't load the customized SerDe
URL: https://github.com/apache/pulsar/pull/5357#discussion_r334229383
 
 

 ##########
 File path: 
pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/JavaInstanceRunnable.java
 ##########
 @@ -207,6 +207,8 @@ JavaInstance setupJavaInstance() throws Exception {
 
         ContextImpl contextImpl = setupContext();
 
+        Thread.currentThread().setContextClassLoader(functionClassLoader);
 
 Review comment:
   I don't think it is a good fix here. Because there two class loaders in the 
java instance, one is instance class loader and the other one is the function 
class loader. We set the class loader to function class loader before handling 
message and set it back to instance class loader.
   
   I think a better fix is to pass the function class loader to the code that 
load the customized Serde.
   
   Besides that, we should have a unit test or an integration test to verify 
this works.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to