private Collection<ApplicationListener<?>> retrieveApplicationListeners(ResolvableType eventType, Class<?> sourceType, AbstractApplicationEventMulticaster.ListenerRetriever retriever) {
LinkedList allListeners = new LinkedList();
Object beanFactory = this.retrievalMutex;
LinkedHashSet listeners;
LinkedHashSet listenerBeans;
synchronized(this.retrievalMutex) {
listeners = new LinkedHashSet(this.defaultRetriever.applicationListeners);
listenerBeans = new LinkedHashSet(this.defaultRetriever.applicationListenerBeans);
}
Iterator beanFactory1 = listeners.iterator();
while(beanFactory1.hasNext()) {
ApplicationListener listener = (ApplicationListener)beanFactory1.next();
if(this.supportsEvent(listener, eventType, sourceType)) {
if(retriever != null) {
retriever.applicationListeners.add(listener);
}
allListeners.add(listener);
}
}
if(!listenerBeans.isEmpty()) {
BeanFactory beanFactory2 = this.getBeanFactory();
Iterator listener2 = listenerBeans.iterator();
while(listener2.hasNext()) {
String listenerBeanName = (String)listener2.next();
try {
Class listenerType = beanFactory2.getType(listenerBeanName);
if(listenerType == null || this.supportsEvent(listenerType, eventType)) {
ApplicationListener listener1 = (ApplicationListener)beanFactory2.getBean(listenerBeanName, ApplicationListener.class);
if(!allListeners.contains(listener1) && this.supportsEvent(listener1, eventType, sourceType)) {
if(retriever != null) {
retriever.applicationListenerBeans.add(listenerBeanName);
}
allListeners.add(listener1);
}
}
} catch (NoSuchBeanDefinitionException var13) {
;
}
}
}
AnnotationAwareOrderComparator.sort(allListeners);
return allListeners;
}
org.springframework.context.event.AbstractApplicationEventMulticaster