eolivelli commented on a change in pull request #10827:
URL: https://github.com/apache/pulsar/pull/10827#discussion_r646115728



##########
File path: 
pulsar-client-api/src/main/java/org/apache/pulsar/client/internal/ReflectionUtils.java
##########
@@ -51,12 +51,12 @@
         try {
             try {
                 // when the API is loaded in the same classloader as the impl
-                return (Class<T>) 
DefaultImplementation.class.getClassLoader().loadClass(className);
+                return (Class<T>) Class.forName(className, true, 
DefaultImplementation.class.getClassLoader());

Review comment:
       @freeznet in my experience I saw that it is better to fully initialise 
the classes in environments where there are dynamic classloaders, because you 
may see weird errors when you shutdown the classloader and you still try to use 
the class: if the class is not fully loaded you can see NoClassDefFound errors 
or other link related errors.
   
   I can try to use 'false' and test again my code if you feel strong




-- 
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:
[email protected]


Reply via email to