提交 338d63a1 编写于 作者: K kohsuke

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

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
上级 9f620f12
......@@ -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();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册