[rules-users] calling static error function....thread safe?
marunam
sutavis at gmail.com
Mon Apr 18 22:20:01 EDT 2011
Hello,
I am calling static "error" function in ValidationHelper class from drool
rules. My rules are going to be executed in spring based web application. Is
this call to an "error" function thread safe?
public class ValidationHelper {
public static void error (RuleContext kcontext, Object... context) {
KnowledgeRuntime knowledgeRuntime = drools.getKnowledgeRuntime();
ValidationReport validationReport = (ValidationReport)
knowledgeRuntime
.getGlobal(ValidationConstants.VALIDATION_REPORT_GLOBAL);
ReportFactory reportFactory = (ReportFactory)
knowledgeRuntime
.getGlobal(ValidationConstants.REPORT_FACTORY_GLOBAL);
validationReport.addMessage(reportFactory.createMessage(
Message.Type.ERROR, messageKey, context));
}
}
import org.drools.runtime.rule.RuleContext;
import function ValidationHelper.error;
...
rule test
when
#condition
then
error(drools)
Please advise
Thanks
--
View this message in context: http://drools.46999.n3.nabble.com/calling-static-error-function-thread-safe-tp2837244p2837244.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
More information about the rules-users
mailing list