perf[event]: 异常无用代码

This commit is contained in:
jaysunxiao
2021-06-25 21:27:55 +08:00
parent 0e319df185
commit 9d6cf9a830
2 changed files with 1 additions and 12 deletions
@@ -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;
}
}