4 Replies Latest reply on Nov 4, 2011 1:41 PM by dme

    Using Timers to Interrupt Synchronous Process in jBPM5

    dme

      Hi,

       

      How can I use an event timer to interrupt a synchronous process in jBPM5? I have created a process which has a subprocess that performs a task (say MyCustomTask). I have a boundary event timer set to 500ms. I observe the following behaviour:

       

      1. If in MyCustomTask if I do not call "completeWorkItem", the event timer fires correctly after 500ms

      2. If in MyCustomTask if I make a call to "completeWorkItem" as the only thing the task does, the event timer does not fire which is as expected, as the sub-process has completed before the timer got a chance to fire

      3. If in MyCustomTask if I sleep for 1sec (1000ms) and then make call "completeWorkItem", the event timer does not fire. How can I get the timer to fire in this case?

       

      It seems that the timer is using the same thread as the MyCustomTask and for synchronous task it will not fire? How can I make the timer to fire when if a sub-process does not complete within "x" seconds?

       

      Attached is the process file and Java (Handler and Driver) code for my test.

       

      Thanks.