[rules-users] fireUntilHalt() and OSGi - CPU load

mardo mardo at abicola.de
Fri Aug 13 08:45:52 EDT 2010


"When invoking fireUntilHalt() for my StatefulKnowledgeSession, CPU load
rises to 25% (meaning one complete core on the quad-core machine)."

I can confirm this issue. Below is a minimal example. I have noticed that in
DefaultAgenda, missedNotifyAll is always true in this case, is this an
intended behaviour?


<?xml version="1.0" encoding="UTF-8"?> 
<definitions id="Definition"
             targetNamespace="http://www.jboss.org/drools"
             typeLanguage="http://www.java.com/javaTypes"
             expressionLanguage="http://www.mvel.org/2.0"
             xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
             xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
             xs:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL
BPMN20.xsd"
             xmlns:g="http://www.jboss.org/drools/flow/gpd"
             xmlns:tns="http://www.jboss.org/drools">

  <process processType="Private" isExecutable="true" id="servicerequest2"
name="servicerequest.b" >

    <!-- nodes -->
    <startEvent id="_1" name="Manual Trigger (Customer Calls)" g:x="19"
g:y="124" g:width="48" g:height="48" />
    <endEvent id="_19" name="End" g:x="463" g:y="148" g:width="48"
g:height="48" >
        <terminateEventDefinition/>
    </endEvent>
    <userTask id="_22" name="Initialize Service Request Process" g:x="139"
g:y="234" g:width="100" g:height="48" >

      <potentialOwner>
        <resourceAssignmentExpression>
          <formalExpression>john</formalExpression>
        </resourceAssignmentExpression>
      </potentialOwner>
    </userTask>

    <!-- connections -->
    <sequenceFlow id="_22-_19" sourceRef="_22" targetRef="_19" />
    <sequenceFlow id="_1-_22" sourceRef="_1" targetRef="_22" />

  </process>

</definitions>



public void test() throws InterruptedException{
		try {
			// load up the knowledge base
			KnowledgeBase kbase = readKnowledgeBase();
			final StatefulKnowledgeSession ksession =
kbase.newStatefulKnowledgeSession();
			
			
			WSHumanTaskHandler wsh = new WSHumanTaskHandler();
			wsh.setConnection("127.0.0.1", 9123);
			ksession.getWorkItemManager().registerWorkItemHandler("Human Task", wsh);

			
			
			new Thread(new Runnable() {
				  public void run() {
				    ksession.fireUntilHalt();
				  }
				}).start();
			ksession.startProcess("servicerequest2");
		} catch (Throwable t) {
			t.printStackTrace();
		}
		
		
		Thread.sleep(1200000);

			

	}

	private static KnowledgeBase readKnowledgeBase() throws Exception {
		KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();

	
kbuilder.add(ResourceFactory.newClassPathResource("testcases/integrationuc/servicerequest.bpmn"),
ResourceType.BPMN2);
		return kbuilder.newKnowledgeBase();
	}

-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/fireUntilHalt-and-OSGi-CPU-load-tp1022352p1131701.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list