This is an automated email from the ASF dual-hosted git repository.
mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 4d263ff ReflectionUtils use Class.forName in order to properly
discover classes in Functions Runtime while using DefaultImplementation (#10827)
4d263ff is described below
commit 4d263ff7752c3156326cd4ab3b1bfbc5d81daeff
Author: Enrico Olivelli <[email protected]>
AuthorDate: Sun Jun 6 17:09:35 2021 +0200
ReflectionUtils use Class.forName in order to properly discover classes in
Functions Runtime while using DefaultImplementation (#10827)
Using Class.forName allows Java classes loaded in the Functions Runtime to
fully use the Implementation classes loaded from the Pulsar API
using DefaultImplementation
Co-authored-by: Enrico Olivelli <[email protected]>
---
.../main/java/org/apache/pulsar/client/internal/ReflectionUtils.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git
a/pulsar-client-api/src/main/java/org/apache/pulsar/client/internal/ReflectionUtils.java
b/pulsar-client-api/src/main/java/org/apache/pulsar/client/internal/ReflectionUtils.java
index 59db2cc..c33f1f1 100644
---
a/pulsar-client-api/src/main/java/org/apache/pulsar/client/internal/ReflectionUtils.java
+++
b/pulsar-client-api/src/main/java/org/apache/pulsar/client/internal/ReflectionUtils.java
@@ -51,12 +51,12 @@ class ReflectionUtils {
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());
} catch (Exception e) {
// when the API is loaded in a separate classloader as the impl
// the classloader that loaded the impl needs to be a child
classloader of the classloader
// that loaded the API
- return (Class<T>)
Thread.currentThread().getContextClassLoader().loadClass(className);
+ return (Class<T>) Class.forName(className, true,
Thread.currentThread().getContextClassLoader());
}
} catch (ClassNotFoundException | NoClassDefFoundError e) {
throw new RuntimeException(e);