Hi Laune,
As you suggested i divided the validate method into three as
below:
public static void validate(Object beanDetails,String rule, List
errorsList){
long methodStartTime=System.currentTimeMillis();
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){
long methodStartTime=System.currentTimeMillis();
KnowledgeBuilder kbuilder = createKnowledgeBuilder(rule);
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
long methodEndTime=System.currentTimeMillis();
System.out.println("Time taken to build
KnowledgeBase::"+(methodEndTime-methodStartTime));
return kbase;
}
private static KnowledgeBuilder createKnowledgeBuilder(String rule){
long methodStartTime=System.currentTimeMillis();
KnowledgeBuilder kbuilder =KnowledgeBuilderFactory.newKnowledgeBuilder();
Resource resource = new ClassPathResource(RULE_CLASSPATH+rule);
kbuilder.add(resource, ResourceType.DRL );
KnowledgeBuilderErrors errors = kbuilder.getErrors();
if (errors.size() > 0) {
for (KnowledgeBuilderError error: errors) {
System.err.println(error);
}
}
long methodEndTime=System.currentTimeMillis();
System.out.println("Time taken to build
KnowledgeBuilder::"+(methodEndTime-methodStartTime));
return kbuilder;
}
but i am not able to understand , how will this help to improve the
perfoemance?
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.