[jboss-jira] [JBoss JIRA] (DROOLS-1540) Drools does not work with spring-boot-devtools
Mario Fusco (Jira)
issues at jboss.org
Sun Apr 28 05:06:00 EDT 2019
[ https://issues.jboss.org/browse/DROOLS-1540?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13727323#comment-13727323 ]
Mario Fusco commented on DROOLS-1540:
-------------------------------------
Let me clarify a bit more what happens here. A Drools knowledge base implements a (highly customizied and improved) variance of the rete algorithm https://en.wikipedia.org/wiki/Rete_algorithm. There the first layer of the alpha network is made by what we call Object Type nodes. The role of OTNs is performing a first discrimination based on the type (class) of the object to be matched. For instance if a rule is pattern matching on an object of class Person the corresponding OTN will filter only the objects that are instances of that class.
Given my current understanding what spring-boot-devtools does is "transparently" creating a different version of that Person class on a different classloader. The problem is that in this way the Person OTN is not able to match instances of this second Person class and then no rule can fire. I disagree that this is a Drools limitation: even if the OTN would be able to match this new Person object, for instance using the class name instead of the class itself (something that it is not possible because it would break polymorphism support) we would just delay the problem to a later stage of the network when I will get a ClassCastException when any of the alpha or beta nodes will try to read a property of the object.
[~snicoll] I'd really would love to solve this problem, but I haven't found a solution yet and unfortunately I'm not sure that I'm understanding what you're suggesting. What do you mean with "specify the classloader"? Is there a way to be notified when spring-boot-devtools decides to create a different classloader? If so I could try to "rewire" the knowledge base against the new classloader. Thanks for clarification.
> Drools does not work with spring-boot-devtools
> ----------------------------------------------
>
> Key: DROOLS-1540
> URL: https://issues.jboss.org/browse/DROOLS-1540
> Project: Drools
> Issue Type: Bug
> Components: core engine
> Affects Versions: 6.5.0.Final
> Reporter: G Xiong
> Assignee: Mario Fusco
> Priority: Critical
> Attachments: complete.zip
>
>
> Drools does work with spring-boot-devtools.
> If you add in pom.xml the following, no rules will be fired in Drools.
> <dependency>
> <groupId>org.springframework.boot</groupId>
> <artifactId>spring-boot-devtools</artifactId>
> </dependency>
> if you comment out this, then rules will be fired in Drools.
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
More information about the jboss-jira
mailing list