<br>   Nicholas,<br><br>   I assume that you are using your classes not only in the consequence, but in the LHS of the rules as well, right? In this case, a knowledge base recompilation will be necessary. That is because Drools must indeed keep references to your class in order to be able to properly match incoming facts, extract their attribute values, etc. Drools already provides re-wiring for most of its artifacts, but providing the same to user defined classes would be close to recompile the knowledge base again.<br>
<br>   Now, I am curious about your use case? why do you need to re-load your classes?<br><br>   []s<br>   Edson<br><br><div class="gmail_quote">2009/10/14 Nicholas Hemley <span dir="ltr">&lt;<a href="mailto:nic.hemley@sidonis.com">nic.hemley@sidonis.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">








<div link="blue" vlink="purple" lang="EN-GB">

<div>

<p class="MsoNormal">Hello,</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">I am using various classes in the consequences of my rules
and I would like to dynamically re-load the classes.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">Currently, I include the following code snippet which sets
the class loader:</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">KnowledgeBaseConfiguration kbConf = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(properties,
MyClassLoader.getInstance());</p>

<p class="MsoNormal">KnowledgeBase knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase(kbConf);</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">However, if I change the underlying jar and inform my
classloader of this change, the old class is still used in the rule
consequences.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">I therefore assume that Drools is storing a reference to the
old class in the previously created KnowledgeBases so MyClassLoader.loadClass()
is only invoked the first time the class is required.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">My question is thus: Is there any way to force a class
reload on a KnowledgeBase or do I have to re-create the Knowledgebase?</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">If so, would it be a case of getAllFactHandles() (or
similar) and assert these into a newly created KnowledgeBase with a new
instance of MyClassloader?</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal"><span style="font-size: 10.5pt; font-family: Consolas;">Cheerio,</span></p>

<p class="MsoNormal"><span style="font-size: 10.5pt; font-family: Consolas;">Nic</span></p>

<p class="MsoNormal"><span style="font-size: 10.5pt; font-family: Consolas;"> </span></p>

<p class="MsoNormal"><b><span style="font-size: 8pt; color: rgb(31, 73, 125);">Nicholas Hemley</span></b></p>

<p class="MsoNormal"><b><span style="font-size: 8pt; color: rgb(31, 73, 125);">Senior Developer</span></b></p>

<p class="MsoNormal"><b><span style="font-size: 8pt; color: rgb(31, 73, 125);">Sidonis | Powering a New Generation of Service Assurance</span></b><span style="font-size: 8pt; color: rgb(31, 73, 125);"></span></p>

</div>

</div>


<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>