AnsweredAssumed Answered

How to model a long-running java task?

Question asked by jvoris on Jun 17, 2014
Latest reply on Jun 19, 2014 by trademak
I have a long running java task (runs longer than 5 minutes) that generates a ActivitiOptimisticLockingException because a 2nd instance of the process is started after 5 minutes – well before the 1st instance of the process has a chance to finish.

This thread ( mentions the same problem, and in that thread there is mention of a send/receive solution – but there is no more explanation of what that means.

I've created a workaround where I have my own custom job executor that sets a 30 minute threshold for process completion instead of the default 5 minutes that works, but that doesn't seem like the ideal approach. Here is the bpm for the process:

    <process id="bankImportJob" name="Bank Import Job" isExecutable="true">
        <startEvent id="startevent1" name="Start" >
                <!– Run once a day at 7:00am. –>
                <timeCycle>0 0 7 ? * *</timeCycle>
        <serviceTask id="bankImportServiceTask" name="Bank Import" activiti:class="" />

        <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="bankImportServiceTask" />
        <sequenceFlow id="flow2" sourceRef="bankImportServiceTask" targetRef="theEnd" />

        <endEvent id="theEnd" />

What is a good/right way to model this so that I don't have to worry about how long the bankImportServiceTask runs?