Hi,
Here is my simple workflow,
start —> A —> B —-> C —-> end
Case1:
A,B,C are ServiceTasks with JavaDelegate(ADelegate, BDelegate, CDelegate). Each delegate have 2 second sleep( Thread.sleep(2000) ) call to keep the workflow runnig for 6 seconds. From my JUnit program, i create a thread, which i instantiate this workflow with business key("myKey1"). After this, from my JUnit, I do query for process instance for "myKey1" using runtmieService.createExecutionQuery as well as runtmieService.createProcessInstanceQuery. but both of them returns me null process instance list. At the time, i execute these queries, my javaDelegate print statement tells me that i am at either task A or at task B. So, My workflow is still alive. Even If i query using actual processInstanceId instead businessKey, It does not return me any result. I do have singleton runtimeService and ProcessEngine.
Case2:
If I add receive task after A, B and C and if i execute same queries when waiting after A, it gives me correct results.
I am wondering, why it would not return me any result in Case1? I am not sure if I am doing something that is not inclined with Activiti threading fundamentals.
Thanks,
Yatish