diff --git a/core/src/main/java/hudson/ExtensionList.java b/core/src/main/java/hudson/ExtensionList.java index 1c3dac21ca..0512876f68 100644 --- a/core/src/main/java/hudson/ExtensionList.java +++ b/core/src/main/java/hudson/ExtensionList.java @@ -69,11 +69,12 @@ public class ExtensionList extends AbstractList { /** * Place to store manually registered instances with the per-Hudson scope. + * {@link CopyOnWriteArrayList} is used here to support concurrent iterations and mutation. */ - private final List legacyInstances; + private final CopyOnWriteArrayList legacyInstances; protected ExtensionList(Hudson hudson, Class extensionType) { - this(hudson,extensionType,new Vector()); + this(hudson,extensionType,new CopyOnWriteArrayList()); } /** @@ -83,7 +84,7 @@ public class ExtensionList extends AbstractList { * omits this uses a new {@link Vector}, making the storage lifespan tied to the life of {@link ExtensionList}. * If the manually registerd instances are scoped to VM level, the caller should pass in a static list. */ - protected ExtensionList(Hudson hudson, Class extensionType, List legacyStore) { + protected ExtensionList(Hudson hudson, Class extensionType, CopyOnWriteArrayList legacyStore) { this.hudson = hudson; this.extensionType = extensionType; this.legacyInstances = legacyStore; @@ -215,8 +216,8 @@ public class ExtensionList extends AbstractList { /** * Places to store static-scope legacy instances. */ - private static final Memoizer staticLegacyInstances = new Memoizer() { - public List compute(Class key) { + private static final Memoizer staticLegacyInstances = new Memoizer() { + public CopyOnWriteArrayList compute(Class key) { return new CopyOnWriteArrayList(); } };