Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,9 +16,10 @@
|
||||
|
||||
package org.springframework.context.event;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -210,7 +211,7 @@ public abstract class AbstractApplicationEventMulticaster
|
||||
private Collection<ApplicationListener<?>> retrieveApplicationListeners(
|
||||
ResolvableType eventType, Class<?> sourceType, ListenerRetriever retriever) {
|
||||
|
||||
LinkedList<ApplicationListener<?>> allListeners = new LinkedList<ApplicationListener<?>>();
|
||||
List<ApplicationListener<?>> allListeners = new ArrayList<ApplicationListener<?>>();
|
||||
Set<ApplicationListener<?>> listeners;
|
||||
Set<String> listenerBeans;
|
||||
synchronized (this.retrievalMutex) {
|
||||
@@ -345,23 +346,20 @@ public abstract class AbstractApplicationEventMulticaster
|
||||
*/
|
||||
private class ListenerRetriever {
|
||||
|
||||
public final Set<ApplicationListener<?>> applicationListeners;
|
||||
public final Set<ApplicationListener<?>> applicationListeners = new LinkedHashSet<ApplicationListener<?>>();
|
||||
|
||||
public final Set<String> applicationListenerBeans;
|
||||
public final Set<String> applicationListenerBeans = new LinkedHashSet<String>();
|
||||
|
||||
private final boolean preFiltered;
|
||||
|
||||
public ListenerRetriever(boolean preFiltered) {
|
||||
this.applicationListeners = new LinkedHashSet<ApplicationListener<?>>();
|
||||
this.applicationListenerBeans = new LinkedHashSet<String>();
|
||||
this.preFiltered = preFiltered;
|
||||
}
|
||||
|
||||
public Collection<ApplicationListener<?>> getApplicationListeners() {
|
||||
LinkedList<ApplicationListener<?>> allListeners = new LinkedList<ApplicationListener<?>>();
|
||||
for (ApplicationListener<?> listener : this.applicationListeners) {
|
||||
allListeners.add(listener);
|
||||
}
|
||||
List<ApplicationListener<?>> allListeners = new ArrayList<ApplicationListener<?>>(
|
||||
this.applicationListeners.size() + this.applicationListenerBeans.size());
|
||||
allListeners.addAll(this.applicationListeners);
|
||||
if (!this.applicationListenerBeans.isEmpty()) {
|
||||
BeanFactory beanFactory = getBeanFactory();
|
||||
for (String listenerBeanName : this.applicationListenerBeans) {
|
||||
|
||||
Reference in New Issue
Block a user