mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 12:12:08 +08:00
优化获取上下文的逻辑以避免在热部署插件的环境下有可能会引起的同类由多个类加载引起的问题
This commit is contained in:
@@ -28,6 +28,7 @@ import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentLinkedDeque;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* Slot的抽象类实现
|
||||
@@ -388,8 +389,9 @@ public class Slot {
|
||||
}
|
||||
|
||||
public <T> T getContextBean(Class<T> contextBeanClazz) {
|
||||
T t = (T) contextBeanList.stream().filter(o -> o.getClass().equals(contextBeanClazz)).findFirst().orElse(null);
|
||||
T t = (T) contextBeanList.stream().filter(o -> o.getClass().getName().equals(contextBeanClazz.getName())).findFirst().orElse(null);
|
||||
if (t == null) {
|
||||
contextBeanList.forEach(o -> LOG.info("ChainId[{}], Context class:{},Request class:{}", this.getChainId(), o.getClass().getName(), contextBeanClazz.getName()));
|
||||
throw new NoSuchContextBeanException("this type is not in the context type passed in");
|
||||
}
|
||||
return t;
|
||||
|
||||
Reference in New Issue
Block a user