List Info

Thread: Can drools work in multithreaded environment?




Can drools work in multithreaded environment?
country flaguser name
United States
2008-05-05 01:03:25
Hi,

While doing a load test with jmeter,my web service
application with drools
works fine for few clients(5 simultaneous hits for 10 times)

but when i increase my clients(120 simultanious hits for 100
times) i am
gettin the following exception for 
few client, (out of 12,000 hits 200 throws this exception)

problem encountered at node [11] 5{170,189}: unable to
resolve property:
null pointer exception in property: declr.identifier
org.mvel.TemplateInterpreter.execute(TemplateInterpreter.jav
a:528)
org.mvel.TemplateInterpreter.parse(TemplateInterpreter.java:
341)
org.drools.rule.builder.dialect.java.AbstractJavaBuilder.gen
eratTemplates(AbstractJavaBuilder.java:113)
org.drools.rule.builder.dialect.java.JavaConsequenceBuilder.
build(JavaConsequenceBuilder.java:95)
org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:6
7)
org.drools.compiler.PackageBuilder.addRule(PackageBuilder.ja
va:446)
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder
.java:304)
org.drools.compiler.PackageBuilder.addPackageFromDrl(Package
Builder.java:167)
com.drools.util.RuleEngine.applyRule(RuleEngine.java:47)
com.drools.util.DroolsController.getAdvertisement(DroolsCont
roller.java:94)
com.drools.util.DroolsController.routeBusinessMethod(DroolsC
ontroller.java:67)
com.drools.util.DroolsController.getAdvertisement(DroolsCont
roller.java:43)
com.drools.MyEndpoint.getAdvertisement(MyEndpoint.java:237)
com.drools.MyEndpoint.process(MyEndpoint.java:144)
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(As
yncBaseLifeCycle.java:489)
org.apache.servicemix.common.AsyncBaseLifeCycle.processExcha
nge(AsyncBaseLifeCycle.java:441)
org.apache.servicemix.common.BaseLifeCycle.onMessageExchange
(BaseLifeCycle.java:46)
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.proc
essInBound(DeliveryChannelImpl.java:595)
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(Ab
stractFlow.java:174)
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(S
edaFlow.java:176)
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(Seda
Queue.java:134)
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExe
cutor$Worker.runTask(ThreadPoolExecutor.java:665)
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExe
cutor$Worker.run(ThreadPoolExecutor.java:690)
java.lang.Thread.run(Thread.java:619)

drl file has 6 rules,
5 rules                   - which retract facts which passes
the rule.
1 rule(low salience)  - will add the fact to java.util.List
(set as global)
which passes the rule.

1 . Am i getting this error bcoz of the global list? or any
other reason?
2 . How to solve this problem?

here the rules,

<code>
global java.util.List feasibleAdv;

rule " percentage rule "   
    when
        $adv : Advertisement( percentageLimit != 0 ,
percentageLimit <
playedPercentage )             		
    then
    	System.out.println("remove this adv (failed
percentage):
"+$adv.getAdvertisementID());               
       	retract($adv);
end

rule "per day rule"
    when
        $adv : Advertisement( limitperday != 0 , limitperday
<= playedperday
)        
    then                
        //System.out.println("remove this adv (failed
day):
"+$adv.getAdvertisementID());
        retract($adv);        
end

rule "per week rule"
    when
        $adv : Advertisement( limitperweek != 0 ,
limitperweek <=
playedperweek)        
    then        
        //System.out.println("remove this adv (failed
week):
"+$adv.getAdvertisementID());
        retract($adv);                   
end

rule "per month rule"
    when
        $adv : Advertisement( limitpermonth != 0 ,
limitpermonth <=
playedpermonth)        
    then                
        //System.out.println("remove this adv (failed
month) :
"+$adv.getAdvertisementID());
        retract($adv);                   
end

rule "total played rule"
    when
        $adv : Advertisement( totallimit != 0 , totallimit
<= totalplayed )        
    then                
        //System.out.println("remove this adv (failed
total played) :
"+$adv.getAdvertisementID());
        retract($adv);                   
end


rule "advertisement select rule"
salience -1
	when		
		$adv : Advertisement( $playedPercentPerAdvertisement :
playedPercentPerAdvertisement)		
		not( Advertisement( playedPercentPerAdvertisement <
$playedPercentPerAdvertisement ) )
		$advertisementCount : Integer()						
	then		
		boolean status = true;		
		if($advertisementCount-1 < 0){
			//System.out.println("halted");
			status = false;
			drools.halt();		
		}		
		if(status){			
			feasibleAdv.add($adv);		
			drools.update(
drools.getWorkingMemory().getFactHandle($advertisementCount)
, new
Integer($advertisementCount-1) );
			retract($adv);
		}		
end

</code>
-- 
View this message in context: http://www.nabble.co
m/Can-drools-work-in-multithreaded-environment--tp17053936p1
7053936.html
Sent from the drools - user mailing list archive at
Nabble.com.

_______________________________________________
rules-users mailing list
rules-userslists.jboss.org

https://lists.jboss.org/mailman/listinfo/rules-users

Re: Can drools work in multithreaded environment?
user name
2008-05-05 08:30:05

 &nbsp; Barath,

&nbsp;  What version of drools are you using?

&nbsp;  The drools rulebase is designed to be shared among multiple threads. The working memory (session) is not.
 ;  Having said that, we had a couple bugs in the past regarding multi-thread environments, and so you must use 4.0.7 version that is about to be released. For you test, while you wait for the official release, you can checkout the code and built it from here:

http://anonsvn.labs.jboss.com/labs/jbossrules/branches/4.0.x/

&nbsp;  []s
   Edson

2008/5/5 Barath < barathgunagmail.com">barathgunagmail.com>:

Hi,

While doing a load test with jmeter,my web service application with drools
works fine for few clients(5 simultaneous hits for 10 times)
but when i increase my clients(120 simultanious hits for 100 times) i am
gettin the following exception for
few client, (out of 12,000 hits 200 throws this exception)

problem encountered at node [11] 5{170,189}: unable to resolve property:
null pointer exception in property: declr.identifier
org.mvel.TemplateInterpreter.execute(TemplateInterpreter.java:528)
org.mvel.TemplateInterpreter.parse(TemplateInterpreter.java:341)
org.drools.rule.builder.dialect.java.AbstractJavaBuilder.generatTemplates(AbstractJavaBuilder.java:113)
org.drools.rule.builder.dialect.java.JavaConsequenceBuilder.build(JavaConsequenceBuilder.java:95)
org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:67)
org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:446)
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:304)
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:167)
com.drools.util.RuleEngine.applyRule(RuleEngine.java:47)
com.drools.util.DroolsController.getAdvertisement(DroolsController.java:94)
com.drools.util.DroolsController.routeBusinessMethod(DroolsController.java:67)
com.drools.util.DroolsController.getAdvertisement(DroolsController.java:43)
com.drools.MyEndpoint.getAdvertisement(MyEndpoint.java:237)
com.drools.MyEndpoint.process(MyEndpoint.java:144)
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:489)
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:441)
org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:595)
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:174)
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:176)
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
java.lang.Thread.run(Thread.java:619)

drl file has 6 rules,
5 rules                   - which retract facts which passes the rule.
1 rule(low salience)  - will add the fact to java.util.List (set as global)
which passes the rule.

1 . Am i getting this error bcoz of the global list? or any other reason?
2 . How to solve this problem?

here the rules,

<code&gt;
global java.util.List feasibleAdv;

rule " percentage rule "
   when
       $adv : Advertisement( percentageLimit != 0 , percentageLimit <
playedPercentage )
   then
       System.out.println("remove this adv (failed percentage):
"+$adv.getAdvertisementID());
       retract($adv);
end

rule "per day rule"
   when
       $adv : Advertisement( limitperday != 0 , limitperday <= playedperday
)
   then
       //System.out.println(";remove this adv (failed day):
&quot;+$adv.getAdvertisementID());
       retract($adv);
end

rule "per week rule"
   when
       $adv : Advertisement( limitperweek != 0 , limitperweek <=
playedperweek)
   then
       //System.out.println(";remove this adv (failed week):
&quot;+$adv.getAdvertisementID());
       retract($adv);
end

rule "per month rule"
   when
       $adv : Advertisement( limitpermonth != 0 , limitpermonth <=
playedpermonth)
   then
       //System.out.println(";remove this adv (failed month) :
"+$adv.getAdvertisementID());
       retract($adv);
end

rule "total played rule"
   when
       $adv : Advertisement( totallimit != 0 , totallimit <= totalplayed )
   then
       //System.out.println(";remove this adv (failed total played) :
"+$adv.getAdvertisementID());
       retract($adv);
end


rule "advertisement select rule"
salience -1
       when
               $adv : Advertisement( $playedPercentPerAdvertisement :
playedPercentPerAdvertisement)
               not( Advertisement( playedPercentPerAdvertisement <
$playedPercentPerAdvertisement ) )
               $advertisementCount : Integer()
       then
               boolean status = true;
               if($advertisementCount-1 < 0){
                       //System.out.println(";halted&quot;);
                       status = false;
                       drools.halt();
               }
               if(status){
                       feasibleAdv.add($adv);
                       drools.update(
drools.getWorkingMemory().getFactHandle($advertisementCount), new
Integer($advertisementCount-1) );
                       retract($adv);
               }
end

&lt;/code>
--
View this message in context: http://www.nabble.com/Can-drools-work-in-multithreaded-environment--tp17053936p17053936.html
Sent from the drools - user mailing list archive at Nabble.com.

_______________________________________________
rules-users mailing list
rules-userslists.jboss.org">rules-userslists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
Edson Tirelli
JBoss Drools Core Development
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat www.jboss.com
Re: Can drools work in multithreaded environment?
country flaguser name
United States
2008-05-06 23:50:51
Edson,
I am using  4.0.3 version.

In my code,
 * For each thread new rule base and StatefulSession is
created. 
 * Then why i am getting the previously mentioned
exceptions(which i posted
in the first message) for few    threads only while other
works fine. 
 * Your suggestions please,
    " 1 . Am i getting this error bcoz of the global
list? or any other
reason?
      2 . How to solve this problem?"

~Barath.


Edson Tirelli-3 wrote:
> 
>    Barath,
> 
>    What version of drools are you using?
> 
>    The drools rulebase is designed to be shared among
multiple threads.
> The
> working memory (session) is not.
>    Having said that, we had a couple bugs in the past
regarding
> multi-thread
> environments, and so you must use 4.0.7 version that is
about to be
> released. For you test, while you wait for the official
release, you can
> checkout the code and built it from here:
> 
> http://anonsvn.labs.jboss.com/labs/jbossrules/branc
hes/4.0.x/
> 
>    []s
>    Edson
> 
> 2008/5/5 Barath <barathgunagmail.com>:
> 
>>
>> Hi,
>>
>> While doing a load test with jmeter,my web service
application with
>> drools
>> works fine for few clients(5 simultaneous hits for
10 times)
>> but when i increase my clients(120 simultanious
hits for 100 times) i am
>> gettin the following exception for
>> few client, (out of 12,000 hits 200 throws this
exception)
>>
>> problem encountered at node [11] 5{170,189}: unable
to resolve property:
>> null pointer exception in property:
declr.identifier
>>
org.mvel.TemplateInterpreter.execute(TemplateInterpreter.jav
a:528)
>>
org.mvel.TemplateInterpreter.parse(TemplateInterpreter.java:
341)
>>
>>
org.drools.rule.builder.dialect.java.AbstractJavaBuilder.gen
eratTemplates(AbstractJavaBuilder.java:113)
>>
>>
org.drools.rule.builder.dialect.java.JavaConsequenceBuilder.
build(JavaConsequenceBuilder.java:95)
>>
org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:6
7)
>>
org.drools.compiler.PackageBuilder.addRule(PackageBuilder.ja
va:446)
>>
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder
.java:304)
>>
>>
org.drools.compiler.PackageBuilder.addPackageFromDrl(Package
Builder.java:167)
>>
com.drools.util.RuleEngine.applyRule(RuleEngine.java:47)
>>
>>
com.drools.util.DroolsController.getAdvertisement(DroolsCont
roller.java:94)
>>
>>
com.drools.util.DroolsController.routeBusinessMethod(DroolsC
ontroller.java:67)
>>
>>
com.drools.util.DroolsController.getAdvertisement(DroolsCont
roller.java:43)
>>
com.drools.MyEndpoint.getAdvertisement(MyEndpoint.java:237)
>> com.drools.MyEndpoint.process(MyEndpoint.java:144)
>>
>>
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(As
yncBaseLifeCycle.java:489)
>>
>>
org.apache.servicemix.common.AsyncBaseLifeCycle.processExcha
nge(AsyncBaseLifeCycle.java:441)
>>
>>
org.apache.servicemix.common.BaseLifeCycle.onMessageExchange
(BaseLifeCycle.java:46)
>>
>>
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.proc
essInBound(DeliveryChannelImpl.java:595)
>>
>>
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(Ab
stractFlow.java:174)
>>
>>
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(S
edaFlow.java:176)
>>
>>
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(Seda
Queue.java:134)
>>
>>
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExe
cutor$Worker.runTask(ThreadPoolExecutor.java:665)
>>
>>
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExe
cutor$Worker.run(ThreadPoolExecutor.java:690)
>> java.lang.Thread.run(Thread.java:619)
>>
>> drl file has 6 rules,
>> 5 rules                   - which retract facts
which passes the rule.
>> 1 rule(low salience)  - will add the fact to
java.util.List (set as
>> global)
>> which passes the rule.
>>
>> 1 . Am i getting this error bcoz of the global
list? or any other reason?
>> 2 . How to solve this problem?
>>
>> here the rules,
>>
>> <code>
>> global java.util.List feasibleAdv;
>>
>> rule " percentage rule "
>>    when
>>        $adv : Advertisement( percentageLimit != 0 ,
percentageLimit <
>> playedPercentage )
>>    then
>>        System.out.println("remove this adv
(failed percentage):
>> "+$adv.getAdvertisementID());
>>        retract($adv);
>> end
>>
>> rule "per day rule"
>>    when
>>        $adv : Advertisement( limitperday != 0 ,
limitperday <=
>> playedperday
>> )
>>    then
>>        //System.out.println("remove this adv
(failed day):
>> "+$adv.getAdvertisementID());
>>        retract($adv);
>> end
>>
>> rule "per week rule"
>>    when
>>        $adv : Advertisement( limitperweek != 0 ,
limitperweek <=
>> playedperweek)
>>    then
>>        //System.out.println("remove this adv
(failed week):
>> "+$adv.getAdvertisementID());
>>        retract($adv);
>> end
>>
>> rule "per month rule"
>>    when
>>        $adv : Advertisement( limitpermonth != 0 ,
limitpermonth <=
>> playedpermonth)
>>    then
>>        //System.out.println("remove this adv
(failed month) :
>> "+$adv.getAdvertisementID());
>>        retract($adv);
>> end
>>
>> rule "total played rule"
>>    when
>>        $adv : Advertisement( totallimit != 0 ,
totallimit <= totalplayed
>> )
>>    then
>>        //System.out.println("remove this adv
(failed total played) :
>> "+$adv.getAdvertisementID());
>>        retract($adv);
>> end
>>
>>
>> rule "advertisement select rule"
>> salience -1
>>        when
>>                $adv : Advertisement(
$playedPercentPerAdvertisement :
>> playedPercentPerAdvertisement)
>>                not( Advertisement(
playedPercentPerAdvertisement <
>> $playedPercentPerAdvertisement ) )
>>                $advertisementCount : Integer()
>>        then
>>                boolean status = true;
>>                if($advertisementCount-1 < 0){
>>                       
//System.out.println("halted");
>>                        status = false;
>>                        drools.halt();
>>                }
>>                if(status){
>>                        feasibleAdv.add($adv);
>>                        drools.update(
>>
drools.getWorkingMemory().getFactHandle($advertisementCount)
, new
>> Integer($advertisementCount-1) );
>>                        retract($adv);
>>                }
>> end
>>
>> </code>
>> --
>> View this message in context:
>> http://www.nabble.co
m/Can-drools-work-in-multithreaded-environment--tp17053936p1
7053936.html
>> Sent from the drools - user mailing list archive at
Nabble.com.
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-userslists.jboss.org
>> 
https://lists.jboss.org/mailman/listinfo/rules-users
>>
> 
> 
> 
> -- 
> Edson Tirelli
> JBoss Drools Core Development
> Office: +55 11 3529-6000
> Mobile: +55 11 9287-5646
> JBoss, a division of Red Hat  www.jboss.com
> 
> _______________________________________________
> rules-users mailing list
> rules-userslists.jboss.org
> 
https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 

-- 
View this message in context: http://www.nabble.c
om/Can-i-use-drools-in-multithreaded-environment--tp17053936
p17097302.html
Sent from the drools - user mailing list archive at
Nabble.com.

_______________________________________________
rules-users mailing list
rules-userslists.jboss.org

https://lists.jboss.org/mailman/listinfo/rules-users

Re: Can drools work in multithreaded environment?
user name
2008-05-07 04:05:28

 &nbsp; You must update to 4.0.7. You are probably facing the issues we had in 4.0.3.

&nbsp;  []s
   Edson

2008/5/7 Barath < barathgunagmail.com">barathgunagmail.com>:

Edson,
I am using  4.0.3 version.

In my code,
&nbsp;* For each thread new rule base and StatefulSession is created.
 * Then why i am getting the previously mentioned exceptions(which i posted
in the first message) for few    threads only while other works fine.
&nbsp;* Your suggestions please,
   &quot; 1 . Am i getting this error bcoz of the global list? or any other
reason?
     2 . How to solve this problem?&quot;

~Barath.


Edson Tirelli-3 wrote:
&gt;
>    Barath,
>
>    What version of drools are you using?
&gt;
>    The drools rulebase is designed to be shared among multiple threads.
> The
> working memory (session) is not.
>;    Having said that, we had a couple bugs in the past regarding
> multi-thread
> environments, and so you must use 4.0.7 version that is about to be
> released. For you test, while you wait for the official release, you can
> checkout the code and built it from here:
&gt;
> http://anonsvn.labs.jboss.com/labs/jbossrules/branches/4.0.x/
>
>    []s
>    Edson
>
> 2008/5/5 Barath < barathgunagmail.com">barathgunagmail.com>:
>;
>>;
>>; Hi,
>>
>> While doing a load test with jmeter,my web service application with
>;> drools
&gt;> works fine for few clients(5 simultaneous hits for 10 times)
&gt;> but when i increase my clients(120 simultanious hits for 100 times) i am
>&gt; gettin the following exception for
>> few client, (out of 12,000 hits 200 throws this exception)
>>
>> problem encountered at node [11] 5{170,189}: unable to resolve property:
>> null pointer exception in property: declr.identifier
&gt;> org.mvel.TemplateInterpreter.execute(TemplateInterpreter.java:528)
>>; org.mvel.TemplateInterpreter.parse(TemplateInterpreter.java:341)
>>
>> org.drools.rule.builder.dialect.java.AbstractJavaBuilder.generatTemplates(AbstractJavaBuilder.java:113)
>;>
>;> org.drools.rule.builder.dialect.java.JavaConsequenceBuilder.build(JavaConsequenceBuilder.java:95)
>> org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:67)
>> org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:446)
>&gt; org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:304)
>;>
>;> org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:167)
>>; com.drools.util.RuleEngine.applyRule(RuleEngine.java:47)
>&gt;
>&gt; com.drools.util.DroolsController.getAdvertisement(DroolsController.java:94)
>>
>> com.drools.util.DroolsController.routeBusinessMethod(DroolsController.java:67)
>&gt;
>&gt; com.drools.util.DroolsController.getAdvertisement(DroolsController.java:43)
>> com.drools.MyEndpoint.getAdvertisement(MyEndpoint.java:237)
>;> com.drools.MyEndpoint.process(MyEndpoint.java:144)
&gt;>
&gt;> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:489)
>>
>> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:441)
>;>
>;> org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
&gt;>
&gt;> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:595)
>&gt;
>&gt; org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:174)
>>
>> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:176)
>>;
>>; org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
>>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
>>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
&gt;> java.lang.Thread.run(Thread.java:619)
>;>
>;> drl file has 6 rules,
&gt;> 5 rules                   - which retract facts which passes the rule.
&gt;> 1 rule(low salience)  - will add the fact to java.util.List (set as
>&gt; global)
>> which passes the rule.
&gt;>
&gt;> 1 . Am i getting this error bcoz of the global list? or any other reason?
>> 2 . How to solve this problem?
>>
>> here the rules,
&gt;>
&gt;> <code&gt;
>&gt; global java.util.List feasibleAdv;
>&gt;
>&gt; rule " percentage rule "
&gt;>    when
>>        $adv : Advertisement( percentageLimit != 0 , percentageLimit <
>;> playedPercentage )
>&gt;    then
>>        System.out.println("remove this adv (failed percentage):
>&gt; "+$adv.getAdvertisementID());
>&gt;        retract($adv);
>> end
>>
>> rule "per day rule"
>>    when
>>        $adv : Advertisement( limitperday != 0 , limitperday <=
&gt;> playedperday
>&gt; )
>&gt;    then
>>        //System.out.println(";remove this adv (failed day):
&gt;> "+$adv.getAdvertisementID());
>&gt;        retract($adv);
>> end
>>
>> rule "per week rule"
>>    when
>>        $adv : Advertisement( limitperweek != 0 , limitperweek <=
&gt;> playedperweek)
>>    then
>>        //System.out.println(";remove this adv (failed week):
&gt;> "+$adv.getAdvertisementID());
>&gt;        retract($adv);
>> end
>>
>> rule "per month rule"
>>    when
>>        $adv : Advertisement( limitpermonth != 0 , limitpermonth <=
&gt;> playedpermonth)
>;>    then
>>        //System.out.println(";remove this adv (failed month) :
>&gt; "+$adv.getAdvertisementID());
>&gt;        retract($adv);
>> end
>>
>> rule "total played rule"
>>    when
>>        $adv : Advertisement( totallimit != 0 , totallimit <= totalplayed
>>; )
>&gt;    then
>>        //System.out.println(";remove this adv (failed total played) :
>&gt; "+$adv.getAdvertisementID());
>&gt;        retract($adv);
>> end
>>
>>
>> rule "advertisement select rule"
>> salience -1
>&gt;        when
>>                $adv : Advertisement( $playedPercentPerAdvertisement :
>&gt; playedPercentPerAdvertisement)
>>                not( Advertisement( playedPercentPerAdvertisement <
>;> $playedPercentPerAdvertisement ) )
>&gt;                $advertisementCount : Integer()
>>        then
>>                boolean status = true;
&gt;>                if($advertisementCount-1 < 0){
>>                        //System.out.println(";halted&quot;);
>>                        status = false;
&gt;>                        drools.halt();
>>                }
>>                if(status){
&gt;>                        feasibleAdv.add($adv);
&gt;>                        drools.update(
>> drools.getWorkingMemory().getFactHandle($advertisementCount), new
>> Integer($advertisementCount-1) );
>&gt;                        retract($adv);
>>                }
>> end
>>
>> </code&gt;
>&gt; --
>&gt; View this message in context:
>> http://www.nabble.com/Can-drools-work-in-multithreaded-environment--tp17053936p17053936.html
>> Sent from the drools - user mailing list archive at Nabble.com.
>>;
>>; _______________________________________________
>> rules-users mailing list
>;> rules-userslists.jboss.org">rules-userslists.jboss.org
&gt;> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
&gt;
>
> --
> Edson Tirelli
> JBoss Drools Core Development
> Office: +55 11 3529-6000
> Mobile: +55 11 9287-5646
> JBoss, a division of Red Hat www.jboss.com
>
> _______________________________________________
> rules-users mailing list
>; rules-userslists.jboss.org">rules-userslists.jboss.org
&gt; https://lists.jboss.org/mailman/listinfo/rules-users
>
&gt;

--
View this message in context: http://www.nabble.com/Can-i-use-drools-in-multithreaded-environment--tp17053936p17097302.html
Sent from the drools - user mailing list archive at Nabble.com.

_______________________________________________
rules-users mailing list
rules-userslists.jboss.org">rules-userslists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
Edson Tirelli
JBoss Drools Core Development
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat www.jboss.com
[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )