Hi!
I have a flow where I call external webservices parallel from my own
WorkItemHandler. I have a ExecutorService and in executeWorkItem I submit a
Callable what does the work, so executeWorkItem return immediately. The
Callable calls workItemManager.completeWorkItem after the work is done.
As far as I can judge it works but I see the following problems:
- Is the workItemManager threadsafe? Can i call completeWorkItem() from a
other thread?
- In the parallel threads I do a ksession.insert(). Is this safe?
- Should I wrap the StatefulKnowledgeSession in a thread safe wrapper?
- fireAllRules does not wait for the process to finish but returns
immediately so I have to use fireUntilHalt. This uses one CPU core
completely. My solution is:
ProcessInstance prc = ksession.startProcess("Main");
while (prc.getState() == ProcessInstance.STATE_ACTIVE) {
Thread.sleep(100);
ksession.fireAllRules();
}
Is this OK or is there a better solution? I dont like polling ;-(.
Thanks!
juergen
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/Implementation-proble...
Sent from the Drools - User mailing list archive at
Nabble.com.