mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-13 20:12:14 +00:00
URLClassLoader support for PluginFirstClassLoader (#5970)
Co-authored-by: Jesse Glick <jglick@cloudbees.com>
This commit is contained in:
1 parent
2ea1148286
commit
bccbc865e4
4 files changed
+232
-12
No files matched your search
@@ -285,19 +285,18 @@ public class ClassicPluginStrategy implements PluginStrategy {
|
||||
* Creates the classloader that can load all the specified jar files and delegate to the given parent.
|
||||
*/
|
||||
protected ClassLoader createClassLoader(List<File> paths, ClassLoader parent, Attributes atts) throws IOException {
|
||||
if (atts != null) {
|
||||
String usePluginFirstClassLoader = atts.getValue( "PluginFirstClassLoader" );
|
||||
if (Boolean.parseBoolean( usePluginFirstClassLoader )) {
|
||||
PluginFirstClassLoader classLoader = new PluginFirstClassLoader();
|
||||
classLoader.setParentFirst( false );
|
||||
classLoader.setParent( parent );
|
||||
classLoader.addPathFiles( paths );
|
||||
return classLoader;
|
||||
}
|
||||
}
|
||||
boolean usePluginFirstClassLoader =
|
||||
atts != null && Boolean.parseBoolean(atts.getValue("PluginFirstClassLoader"));
|
||||
|
||||
if (useAntClassLoader) {
|
||||
AntClassLoader classLoader = new AntClassLoader(parent, true);
|
||||
AntClassLoader classLoader;
|
||||
if (usePluginFirstClassLoader) {
|
||||
classLoader = new PluginFirstClassLoader();
|
||||
classLoader.setParentFirst(false);
|
||||
classLoader.setParent(parent);
|
||||
} else {
|
||||
classLoader = new AntClassLoader(parent, true);
|
||||
}
|
||||
classLoader.addPathFiles(paths);
|
||||
return classLoader;
|
||||
} else {
|
||||
@@ -305,7 +304,13 @@ public class ClassicPluginStrategy implements PluginStrategy {
|
||||
for (File path : paths) {
|
||||
urls.add(path.toURI().toURL());
|
||||
}
|
||||
return new URLClassLoader2(urls.toArray(new URL[0]), parent);
|
||||
URLClassLoader2 classLoader;
|
||||
if (usePluginFirstClassLoader) {
|
||||
classLoader = new PluginFirstClassLoader2(urls.toArray(new URL[0]), parent);
|
||||
} else {
|
||||
classLoader = new URLClassLoader2(urls.toArray(new URL[0]), parent);
|
||||
}
|
||||
return classLoader;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user