-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
通过注解(即生成代理类)形式接入,多线程共享Rules时存在线程安全问题 #411
Comments
RuleProxy创建的时候优先把rule的元数据获取到并赋值就行了 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
java.util.ConcurrentModificationException: null
at java.util.TreeMap$PrivateEntryIterator.nextEntry(TreeMap.java:1207)
at java.util.TreeMap$KeyIterator.next(TreeMap.java:1261)
at org.jeasy.rules.core.RuleProxy.appendActionMethodsNames(RuleProxy.java:353)
at org.jeasy.rules.core.RuleProxy.getRuleDescription(RuleProxy.java:334)
at org.jeasy.rules.core.RuleProxy.invoke(RuleProxy.java:101)
at com.sun.proxy.$Proxy160.getDescription(Unknown Source)
at org.jeasy.rules.core.DefaultRulesEngine.log(DefaultRulesEngine.java:146)
at org.jeasy.rules.core.DefaultRulesEngine.doFire(DefaultRulesEngine.java:80)
at org.jeasy.rules.core.DefaultRulesEngine.fire(DefaultRulesEngine.java:70)
private Set getActionMethodBeans() {
if (this.actionMethods == null) {
this.actionMethods = new TreeSet<>();
Method[] methods = getMethods();
for (Method method : methods) {
if (method.isAnnotationPresent(Action.class)) {
Action actionAnnotation = method.getAnnotation(Action.class);
int order = actionAnnotation.order();
this.actionMethods.add(new ActionMethodOrderBean(method, order));
}
}
}
return this.actionMethods;
}
内部actionMethods对象是TreeSet非线程安全,多线程并发时,遍历时会抛出ConcurrentModificationException
解决思路:
The text was updated successfully, but these errors were encountered: