urule icon indicating copy to clipboard operation
urule copied to clipboard

决策集循环规则遍历报java.util.ConcurrentModificationException错误

Open ghost opened this issue 5 years ago • 1 comments

为了您的问题能得到及时准确解答,请认真填写下面各个选项,感谢您的配合。

  • 当前使用的URule的具体版本号:

URule Pro试用版 : urule-pro-3.0.0-RC4

  • 遇到的问题详细描述:

无法删除满足条件的集合元素

  • 涉及到的异常信息(完整异常信息):

错误发生位置:执行规则[医嘱排班集合判空(jcr:/schedule/testRemove.rs.xml)]动作错误发生位置:执行规则[筛选被限制的排班(jcr:/schedule/testRemove.rs.xml)]动作错误发生位置:执行规则[筛选被限制的排班(jcr:/schedule/testRemove.rs.xml)]动作 java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:909) at java.util.ArrayList$Itr.next(ArrayList.java:859) at com.bstek.urule.model.rule.loop.LoopRule.execute(LoopRule.java:57) at com.bstek.urule.runtime.agenda.ActivationImpl.execute(ActivationImpl.java:58) at com.bstek.urule.runtime.agenda.ActivationRuleBox.execute(ActivationRuleBox.java:41) at com.bstek.urule.runtime.agenda.Agenda.a(Agenda.java:98) at com.bstek.urule.runtime.agenda.Agenda.activePendedGroupAndExecute(Agenda.java:66) at com.bstek.urule.runtime.AbstractWorkingMemory.activePendedGroupAndExecute(AbstractWorkingMemory.java:97) at com.bstek.urule.model.function.ActiveAndExecutePendedFunctionDescriptor.doFunction(ActiveAndExecutePendedFunctionDescriptor.java:29) at com.bstek.urule.action.ExecuteCommonFunctionAction.execute(ExecuteCommonFunctionAction.java:50) at com.bstek.urule.runtime.agenda.ActivationImpl.a(ActivationImpl.java:87) at com.bstek.urule.runtime.agenda.ActivationImpl.execute(ActivationImpl.java:63) at com.bstek.urule.runtime.agenda.ActivationRuleBox.execute(ActivationRuleBox.java:41) at com.bstek.urule.runtime.agenda.Agenda.execute(Agenda.java:56) at com.bstek.urule.runtime.execution.RuleExecution.a(RuleExecution.java:68) at com.bstek.urule.runtime.execution.RuleExecution.fireRules(RuleExecution.java:41) at com.bstek.urule.runtime.KnowledgeSessionImpl.a(KnowledgeSessionImpl.java:98) at com.bstek.urule.runtime.KnowledgeSessionImpl.fireRules(KnowledgeSessionImpl.java:77) at com.bstek.urule.model.rule.loop.LoopRule.doLoop(LoopRule.java:95) at com.bstek.urule.model.rule.loop.LoopRule.execute(LoopRule.java:58) at com.bstek.urule.runtime.agenda.ActivationImpl.execute(ActivationImpl.java:58) at com.bstek.urule.runtime.agenda.ActivationRuleBox.execute(ActivationRuleBox.java:41) at com.bstek.urule.runtime.agenda.Agenda.execute(Agenda.java:56) at com.bstek.urule.runtime.execution.RuleExecution.a(RuleExecution.java:68) at com.bstek.urule.runtime.execution.RuleExecution.fireRules(RuleExecution.java:41) at com.bstek.urule.runtime.KnowledgeSessionImpl.a(KnowledgeSessionImpl.java:98) at com.bstek.urule.runtime.KnowledgeSessionImpl.fireRules(KnowledgeSessionImpl.java:65) at com.bstek.urule.console.servlet.respackage.PackageServletHandler.doQuickTest(PackageServletHandler.java:638) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.bstek.urule.console.servlet.BaseServletHandler.invokeMethod(BaseServletHandler.java:29) at com.bstek.urule.console.servlet.respackage.PackageServletHandler.execute(PackageServletHandler.java:106) at com.bstek.urule.console.servlet.URuleServlet.service(URuleServlet.java:106) at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:660) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:808) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748)

  • 相关截图:

{YW}OU{~_TDQ)B0547%M@M](https://user-images.githubusercontent.com/36095940/103338777-77403080-4aba-11eb-9a5f-7c997a5663fe.png) ![R92(DQQAPA}_8$C(CXPS19U](https://user-images.githubusercontent.com/36095940/103338784-7a3b2100-4aba-11eb-9b8a-77086039c652.png) ![Q($S2N)Y_%GRNU}83LAWFJF](https://user-images.githubusercontent.com/36095940/103338791-7e673e80-4aba-11eb-83f9-ea0d0dfc2c74.png) ![@~F1004(QG{F~6@AHYD0EC 情景1:传入为“医嘱集合“的医嘱,””“医嘱集合”的字段“医嘱”size为1,医嘱的字段“空腹”为true,医嘱的字段“排班集合”size为1,预期:排班集合为空,实际:报错 情景2:传入为“医嘱集合“的医嘱,“医嘱集合”的字段“医嘱”size为1,医嘱的字段“空腹”为true,医嘱的字段“排班集合”size为2,预期:排班集合为空,实际:只删除了第一个元素且没遍历第二个元素 情景3:传入为“医嘱集合“的医嘱,“医嘱集合”的字段“医嘱”size为1,医嘱的字段“空腹”为true,医嘱的字段“排班集合”size为3,预期:排班集合为空,实际:报错 情景4:传入为医嘱的排班集合,删除某个位置的元素,预期:准确删除特定位置的元素,实际:除了元素在最后一个位置的情况下报错,其他位置可删除成功

ghost avatar Dec 30 '20 08:12 ghost

在知识包执行之前会对参数进行初始化赋默认值,集合类的对象都不是线程安全的对象,要不只迭代,要么将集合类的初始化为线程安全的对象。具体代码就在KnowledgeSessionImpl的构造器,相对还是比较好找。

Askerlve avatar Jan 13 '23 03:01 Askerlve