Hi All
I have few changes to my data class as suggested above and rule and it seems
to work. But that brings me to another question. Here is my new data class
Data class
public class Data {
private int id =0;
public boolean isCheck = false;
public String name = "";
public Data(int id) {
this.id = id;
name = "name"+(int)(this.hashCode());
System.out.println("id is "+id+" name is "+name);
}
public int getId() {
return id;
}
public void setIsCheck() {
isCheck = true;
}
public boolean getIsCheck() {
return isCheck;
}
public String getName() {
return name;
}
}
rule "Unique data"
no-loop
salience 10
when
$data1: Data( $id1: id,isCheck == false)
$data2: Data( isCheck == true, id == $id1)
then
log.log(" data are not unique:"+ $data1.getName() +" and
"+$data2.getName()+ " id is "+$data2.getId()+"
"+$data1.getId());
end
rule "Change data"
no-loop
when
$data: Data(isCheck == false)
then
$data.setIsCheck();
update($data);
end
So you can see from above that I set value false at the start and then set
it to true in a different rule. Now it takes only less then a second to
execute the rule. I was not aware of the fact that each time i insert a rule
it start executing it.
Now my question is
Is it possible to stop working memory to start processing when I am
inserting data ? So don't execute anything untill I am finished adding all
the data and then fireAllrules
thanks ( also thanks to Scott Reed-3 who led to this solution)
Gaurav
--
View this message in context:
http://www.nabble.com/simple-rule-takes-long-time-tp18192098p18233804.html
Sent from the drools - user mailing list archive at
Nabble.com.