You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "gmiklos-ltg (via GitHub)" <gi...@apache.org> on 2023/04/28 09:40:27 UTC

[GitHub] [pulsar] gmiklos-ltg commented on a diff in pull request #20115: [improve][fn] Use functions classloader in TopicSchema.newSchemaInstance() to fix ClassNotFoundException when using custom SerDe classes. (targeted for master)

gmiklos-ltg commented on code in PR #20115:
URL: https://github.com/apache/pulsar/pull/20115#discussion_r1180180833


##########
pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/source/TopicSchema.java:
##########
@@ -49,8 +53,13 @@ public class TopicSchema {
     private final Map<String, Schema<?>> cachedSchemas = new HashMap<>();
     private final PulsarClient client;
 
-    public TopicSchema(PulsarClient client) {
+    private final ClassLoader functionsClassloader;
+
+    public TopicSchema(PulsarClient client, ClassLoader functionsClassloader) {
         this.client = client;
+        this.functionsClassloader = AccessController.doPrivileged(

Review Comment:
   Interestingly IntelliJ IDEA gives me a pretty strong warning that doPrivileged should be used while creating this URLClassLoader. Shall we omit this call and just create the URLClassLoader as it is? I saw other parts of code that made use of doPrivileged (perhaps it also makes static analysis to fail).



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org