Skip to content

Commit

Permalink
[FIXED JENKINS-47713] - Do not copy list of plugins on every call (#3109
Browse files Browse the repository at this point in the history
)

[FIXED JENKINS-47713] - Do not copy list of plugins on every call
  • Loading branch information
Jimilian authored and oleg-nenashev committed Oct 28, 2017
1 parent cf69c29 commit 6e75f73
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions core/src/main/java/hudson/PluginManager.java
Expand Up @@ -254,7 +254,7 @@ private enum PMConstructor {
/**
* All discovered plugins.
*/
protected final List<PluginWrapper> plugins = new ArrayList<PluginWrapper>();
protected final List<PluginWrapper> plugins = new CopyOnWriteArrayList<>();

/**
* All active plugins, topologically sorted so that when X depends on Y, Y appears in the list before X does.
Expand Down Expand Up @@ -463,10 +463,7 @@ protected void reactOnCycle(PluginWrapper q, List<PluginWrapper> cycle)
cgd.run(getPlugins());

// obtain topologically sorted list and overwrite the list
ListIterator<PluginWrapper> litr = getPlugins().listIterator();
for (PluginWrapper p : cgd.getSorted()) {
litr.next();
litr.set(p);
if(p.isActive())
activePlugins.add(p);
}
Expand Down Expand Up @@ -1132,9 +1129,7 @@ public boolean isPluginUploaded() {
*/
@Exported
public List<PluginWrapper> getPlugins() {
List<PluginWrapper> out = new ArrayList<PluginWrapper>(plugins.size());
out.addAll(plugins);
return out;
return Collections.unmodifiableList(plugins);
}

public List<FailedPlugin> getFailedPlugins() {
Expand Down

0 comments on commit 6e75f73

Please sign in to comment.