mirror of https://github.com/apache/kafka.git
KAFKA-6914; Set parent classloader of DelegatingClassLoader same as the worker's (#5720)
The parent classloader of the DelegatingClassLoader and therefore the classloading scheme used by Connect does not have to be fixed to the System classloader. Setting it the same as the one that was used to load the DelegatingClassLoader class itself is more flexible and, while in most cases will result in the System classloader to be used, it will also work in othr managed environments that control classloading differently (OSGi, and others). The fix is minimal and the mainstream use is tested via system tests. Reviewers: Randall Hauch <rhauch@gmail.com>, Jason Gustafson <jason@confluent.io>
This commit is contained in:
parent
5d6c809b5c
commit
fa2039fc1e
|
@ -71,7 +71,11 @@ public class DelegatingClassLoader extends URLClassLoader {
|
|||
}
|
||||
|
||||
public DelegatingClassLoader(List<String> pluginPaths) {
|
||||
this(pluginPaths, ClassLoader.getSystemClassLoader());
|
||||
// Use as parent the classloader that loaded this class. In most cases this will be the
|
||||
// System classloader. But this choice here provides additional flexibility in managed
|
||||
// environments that control classloading differently (OSGi, Spring and others) and don't
|
||||
// depend on the System classloader to load Connect's classes.
|
||||
this(pluginPaths, DelegatingClassLoader.class.getClassLoader());
|
||||
}
|
||||
|
||||
public Set<PluginDesc<Connector>> connectors() {
|
||||
|
|
Loading…
Reference in New Issue