diff --git a/solr/core/src/java/org/apache/solr/pkg/PackageListeners.java b/solr/core/src/java/org/apache/solr/pkg/PackageListeners.java index a4835146a1e..b5b295f156f 100644 --- a/solr/core/src/java/org/apache/solr/pkg/PackageListeners.java +++ b/solr/core/src/java/org/apache/solr/pkg/PackageListeners.java @@ -23,7 +23,7 @@ import java.lang.ref.SoftReference; import java.util.ArrayList; import java.util.Iterator; import java.util.List; - +import java.util.concurrent.CopyOnWriteArrayList; import org.apache.solr.core.PluginInfo; import org.apache.solr.core.SolrCore; import org.apache.solr.logging.MDCLoggingContext; @@ -42,7 +42,7 @@ public class PackageListeners { // this registry only keeps a weak reference because it does not want to // cause a memory leak if the listener forgets to unregister itself - private List> listeners = new ArrayList<>(); + private List> listeners = new CopyOnWriteArrayList<>(); public synchronized void addListener(Listener listener) { listeners.add(new SoftReference<>(listener));