Ok, more pieces in the puzzle :). I still do not understand why you are getting lock/unlock on insertions. In 5.5.1-SNAPSHOT and 5.6.0-SNAPSHOT, those events are fired only when a WRITE lock is acquired to modify the RETE. Insertions and fireAllRules use READ locks that do not generate that kind of events.
Are you getting them even when you run the rules in Eclipse? Notice that WRITE locks are also acquired when STATELESS sessions are used, rather than STATEFUL ones, (which btw was dcrissman's case)... but you are using STATEFUL sessions, so this shouldn't be the case, right? Otherwise, I'd really like to know why the lock is acquired... I would go as afar as forcing a controlled exception in the KBEventListener to see the stack trace during one of those insertions. (So far, I have assumed that the "maintenance" actions on the KB are not triggered by the rules themselves, but by some other control module) Davide On 05/09/2013 05:44 AM, mohdejaz74 wrote: > knowledge-api-5.5.0.Final.jar > knowledge-internal-api-5.5.0.Final.jar > drools-compiler-5.5.1-SNAPSHOT.jar > drools-core-5.5.1-SNAPSHOT.jar > > 4 times kb unlock/unlock is due to 4 objects inserted into session. After > 5th insert it crashes. 5 objects are always inserted into session before > fireAllRules is invoked. It does'nt crash if no rule is added/updated. > > RuleRunner inserts them - 5th object is the actual model object against > which all rules are run > > http-8084-2 and 2967417 are same; i just rename thread once I've serialized > the model object to take the id. > > I've noticed that the four times lock/unlock happens immediately after KB is > modified (ie. rule is removed and added). > > General flow of RuleRunner is ... > > > read xml payload from HttpServletRequest > > create model object from xml > > set thread name to model.id > > get lock on kba (kba is my wrapper class to control access to kb) > > get stateful session > > session.insert( obj1 ) > > session.insert( obj2 ) > > session.insert( obj3 ) > > session.insert( obj4 ) > > fact_handle = session.insert( model ) > > iterate through a list of agenda and set focus to agenda > > sesssion.fireAllRules() > > retract fact_handle from session > > dispose session > > release lock on kba > > Ejaz > > > > -- > View this message in context: > http://drools.46999.n3.nabble.com/threw-error-java-lang-ClassCastException-org-drools-reteoo-FromNode-FromMemory-cannot-be-cast-to-orgy-tp4023497p4023743.html > Sent from the Drools: User forum mailing list archive at Nabble.com. > _______________________________________________ > rules-users mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-users > _______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
