mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-05-30 00:22:02 +00:00
perf[event]: 异常无用代码
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
package com.zfoo.event;
|
||||
|
||||
import com.zfoo.event.manager.EventBus;
|
||||
import com.zfoo.event.schema.EventRegisterProcessor;
|
||||
import com.zfoo.protocol.exception.ExceptionUtils;
|
||||
import com.zfoo.protocol.util.ReflectionUtils;
|
||||
import com.zfoo.util.ThreadUtils;
|
||||
@@ -76,13 +75,6 @@ public class EventContext implements ApplicationListener<ApplicationContextEvent
|
||||
// 初始化上下文
|
||||
EventContext.instance = this;
|
||||
instance.applicationContext = event.getApplicationContext();
|
||||
|
||||
var beanNames = applicationContext.getBeanDefinitionNames();
|
||||
var processor = applicationContext.getBean(EventRegisterProcessor.class);
|
||||
|
||||
for (var beanName : beanNames) {
|
||||
processor.postProcessAfterInitialization(applicationContext.getBean(beanName), beanName);
|
||||
}
|
||||
} else if (event instanceof ContextClosedEvent) {
|
||||
shutdown();
|
||||
ThreadUtils.shutdownForkJoinPool();
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
package com.zfoo.event.schema;
|
||||
|
||||
import com.zfoo.event.EventContext;
|
||||
import com.zfoo.event.manager.EventBus;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
@@ -26,10 +25,8 @@ public class EventRegisterProcessor implements BeanPostProcessor {
|
||||
|
||||
@Override
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
|
||||
if (EventContext.getEventContext() == null) {
|
||||
return bean;
|
||||
}
|
||||
EventBus.registerEventReceiver(bean);
|
||||
return bean;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user