Details
-
Bug
-
Resolution: Done
-
Major
-
5.1.1.FINAL
-
None
Description
A KnowledgeAgent set up to monitor a .drl file, and set to perform incremental builds, will correctly monitor that file for changes.
When a change to that file, however, results in a DRL syntax exception (or any other KnowledgeBuilder errors), the KnowledgeAgent no longer monitors the resource for changes.
This means that a typo in the file effectively stops the KnowledgeAgent from ever seeing that file again. Consequently, an error in the DRL file requires a restart to whatever server is using the KnowledgeAgent.
Esteban and I have found that the error is related to lines 337 and following of KnowledgeAgentImpl.java. Here is a snippet from one of his emails to me:
"The problem seems to be related to the lines you mentioned. When a resource is modified, all its knowledgeDefinition->resource are cleared and reconstructed later. I don't see any reason to unsubscribe the listener though. So the call to Set<KnowledgeDefinition> definitions = this.removeResourceMapping(resource, true); should be Set<KnowledgeDefinition> definitions = this.removeResourceMapping(resource, false);
"That means: remove all the mappings but don't unsubscribe me (the kagent) as a listener."
Further background can be found at http://drools-java-rules-engine.46999.n3.nabble.com/Drools-5-1-What-happens-when-an-incremental-KA-rebuild-fails-td2258083.html