DelegatingApplicationListener uses CopyOnWriteArrayList

Fixes gh-4416
This commit is contained in:
Rob Winch 2017-10-24 15:35:04 -05:00
parent 8fd0ba3bc4
commit 38a8189a62
1 changed files with 2 additions and 2 deletions

View File

@ -20,8 +20,8 @@ import org.springframework.context.ApplicationListener;
import org.springframework.context.event.SmartApplicationListener;
import org.springframework.util.Assert;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
/**
* Used for delegating to a number of SmartApplicationListener instances. This is useful
@ -32,7 +32,7 @@ import java.util.List;
*/
public final class DelegatingApplicationListener implements
ApplicationListener<ApplicationEvent> {
private List<SmartApplicationListener> listeners = new ArrayList<SmartApplicationListener>();
private List<SmartApplicationListener> listeners = new CopyOnWriteArrayList<>();
public void onApplicationEvent(ApplicationEvent event) {
if (event == null) {