I wanted to create a process that turns periodically (every 1S for exemple), that prevents multiple instances from running at the same time:
- Service Task “Verify One …”: created a service task which allows to calculate (in his delegate) the number of process instances that run.
-Gateway: if the number of process instances is greater than 0 then we finish the instance, otherwise we continue to the next service task
- Task that taking time to be completed: within delegate of this task i put a Thread.sleep to simulate the time needed to complete it.
MY Objective: within “Verify One Process Instance At Time” check whether the task “Task taking time” is completed. otherwise, terminate the instance.
- launch 4 instances (one instance each 1s)
- in the “Task Taking Time” : set up a threed.sleep (4s)
- “Task Taking Time” executed once and 3 instances rejected
- the 4 instances are all accessing the “Task Taking Time” task even though I have a threed
Does anyone know how to solve this problem please. I thank you in advance.