I want the Plugin.postInitialize() to see all the other plugins, namely PluginManager.uberClassLoader.

So this code needs to be in a separate method.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@17125 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2009-04-13 21:03:57 +00:00
1 parent 9f620f125b
commit 338d63a1f6
2 files changed
+12 -4

No files matched your search

+11 -4
View File
@@ -158,18 +158,25 @@ public final class PluginManager extends AbstractModelObject {
activePlugins.remove(p);
plugins.remove(p);
}
}
for (PluginWrapper p : activePlugins.toArray(new PluginWrapper[activePlugins.size()])) {
strategy.initializeComponents(p);
/**
* Called immediately after the construction.
* This is a separate method so that code executed from here will see a valid value in
* {@link Hudson#pluginManager}.
*/
public void initialize() {
for (PluginWrapper p : activePlugins.toArray(new PluginWrapper[activePlugins.size()])) {
strategy.initializeComponents(p);
try {
p.getPlugin().postInitialize();
} catch (Exception e) {
failedPlugins.add(new FailedPlugin(p.getShortName(),e));
failedPlugins.add(new FailedPlugin(p.getShortName(), e));
LOGGER.log(Level.SEVERE, "Failed to post-initialize a plug-in " + p.getShortName(), e);
activePlugins.remove(p);
plugins.remove(p);
}
}
}
}
/**
@@ -514,6 +514,7 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
// load plugins.
pluginManager = new PluginManager(context);
pluginManager.initialize();
// if we are loading old data that doesn't have this field
if(slaves==null) slaves = new NodeList();