See inline:
On 12/06/2012, Ini <inder.14(a)gmail.com> wrote:
Hi Laune,
As you suggested i divided the validate method into three as
below:
##### Add a parameter: KnowledgeBase kbase
##### remove parameter String rule
public static void validate(Object beanDetails,String rule, List
errorsList){
long methodStartTime=System.currentTimeMillis();
##### remove next line
KnowledgeBase kbase =createKnowledgeBase(rule);
StatelessKnowledgeSession ksession =
kbase.newStatelessKnowledgeSession();
ksession.setGlobal("errors", errorsList);
ksession.execute(beanDetails);
long methodEndTime=System.currentTimeMillis();
System.out.println("Time taken in Method validate in milli seconds
is::"+(methodEndTime-methodStartTime));
}
private static KnowledgeBase createKnowledgeBase(String rule){
# looks good
}
private static KnowledgeBuilder createKnowledgeBuilder(String rule){
# looks good
}
but i am not able to understand , how will this help to improve the
perfoemance?
By building the KnowledgeBase once and using it many times:
KnowledgeBase kBase = createKnowledgeBase(String rule);
for( Object bean: bagOfBeans ){
validate(kBase,bean, errorsList);
}
-W
Thanks,
Ini
--
View this message in context:
http://drools.46999.n3.nabble.com/Performance-issue-tp4017688p4017858.html
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users