final Thread[] t = new Thread[THREAD_COUNT];
final KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource( "BPMN2-MultiThreadServiceProcess.bpmn" ), ResourceType.BPMN2 );
KnowledgeBase kbase = kbuilder.newKnowledgeBase();
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
ksession.getWorkItemManager().registerWorkItemHandler("Log", new WorkItemHandler() {
public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
Long threadId = (Long) workItem.getParameter("id");
// System.out.println("Executing process instance " + workItem.getProcessInstanceId() + " for thread " + threadId);
workItems.put(workItem.getProcessInstanceId(), threadId);