[rules-users] KnowledgeBase & Classloader - reload class or re-create

Edson Tirelli ed.tirelli at gmail.com
Wed Oct 14 11:27:03 EDT 2009


   Nick,

   I see. In any case, Drools will not allow you to do that without
recompiling the knowledge base, but, why don't you simply make your
"MyFunctions" class be a delegate to your actual functions? So, whenever you
reload your fuctions, all you need to do is rewire things inside your
MyFunctions class... isolated and clean... no need to have things rewired in
Drools side... sounds much lighter than any other approach, even if it was
possible to do the rewire in Drools, it would certainly be heavier...

   Just an idea...

   Edson

2009/10/14 Nicholas Hemley <nic.hemley at sidonis.com>

>  Edson,
>
>
>
> Actually, I only use custom action classes in the RHS (see below)
>
>
>
> e.g.
>
> rule TEARDOWN_3004865719
>
>                 when
>
>                                 child0:MyClass (
>
>                                                 state1 == 0,
>
>                                                 state2 == 0
>
>                                 )
>
>                 then
>
>                                 MyFunctions.performOperation( "TEARDOWN
> _3004865719",
>
>                                                  "message",
>
>                                                  child0,
>
>                                                  true );
>
>                 end
>
>
>
> The classes referenced in the LHS will always stay the same.
>
>
>
> So if we want to re-load the class MyFunctions (since these custom actions
> may be updated), then I currently have to re-create the
> StatefulKnowledgeSession from a new KnowledgeBase, etc. so that the
> findClass() method is called on MyClassLoader.
>
>
>
> Cheerio,
>
> Nic
>
>
>
> *Nicholas Hemley*
>
> *Senior Developer*
>
> *Sidonis | Powering a New Generation of Service Assurance*
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss by Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20091014/df9ff4df/attachment.html 


More information about the rules-users mailing list