Execution of multiple threads on Service Task

Hello,

I have sub process with parallel multi instance and service task , some service task is taking more time to complete , so new thread is getting created and again same service task is getting executed multiple times.

Also getting the OptimisticLockingException while multiple thread are created and running.

How to stop the execution of multiple thread and creation of new thread when the service execution take more time.

Attached a sample BPMN Process and highlighted issue service,

Thanks

Hi,

Mostly this behaviour occurs when there is a race condition between your parallelly executing thread tries to complete and update a task in table which is already been update by another thread. Try out this work around, set your service tasks async before and after to true and exclusive to false. Also verify time taken by service task to complete a job should not exceeds the job execution wait time property(refer).
Hope this helps.