[rules-users] removeKnowledgePackage Call Hangs!!

Swindells, Thomas TSwindells at nds.com
Tue May 18 04:20:49 EDT 2010


Why are you trying to remove a knowledge package while you are in the middle of running rules?  I'm not a drools developer and don't know whether it has been designed to allow this area of code to be re-entrant but to me it seems like you are trying to pull the rug (or at least part of it) out from underneath it.  I'd assume that you are getting null pointers because rules that are on the activation queue are suddenly no longer present in the knowledge base, or some other similar reason.
There's probably two other approaches that you could take which may be safer:
1. Each rule have an activation object (shared across a rules package).  They will only fire if the appropriate package is in the knowledge base, when you no longer want a set of rules to fire then you remove the appropriate activation object.
2. Don't remove the knowledge packages while the rules are still running, instead populate a list of packages which need removing, either stored within the knowledgebase or using a global to pass it back to the application.  When you want to change the knowledge package have your rule export the package you want to remove and then use the context to abort the firing of the knowledge session.  Your application code can then remove the knowledge packages you have selected and then restart the firing of the session.

Thomas

> -----Original Message-----
> From: rules-users-bounces at lists.jboss.org [mailto:rules-users-
> bounces at lists.jboss.org] On Behalf Of malkhafaji
> Sent: 17 May 2010 20:35
> To: rules-users at lists.jboss.org
> Subject: Re: [rules-users] removeKnowledgePackage Call Hangs!!
>
>
> Any help is appreciated. I am stuck on this. I stripped everything down to
> two simple drls, and one of them loads the other as a new KP, and then tries
> to unload it.
>
> Any ideas why the removeKnowledgePackage could possibly throw a
> NullPointerException in M1?? This is really hurting us as we are going live
> with this in a couple of weeks or so.
>
> Any help would be greatly appreciated!
> --
> View this message in context: http://drools-java-rules-
> engine.46999.n3.nabble.com/removeKnowledgePackage-Call-Hangs-
> tp815616p824494.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users


**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster at nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************




More information about the rules-users mailing list