cancel
Showing results for 
Search instead for 
Did you mean: 

concurrent execution with exclusive job

larswillrich
Champ in-the-making
Champ in-the-making
hello,

i've got this situation:

[img]http://s1.directupload.net/images/130301/v3hm273e.jpg[/img]

Service-Call: async=false, exclusive-job=true
T1_1, T5_1, T2_2, T3_2

Service-Call: async=true, exclusive-job=false
T2_1, T3_1

with org.activiti.spring.SpringProcessEngineConfiguration -> jobExecutorActivate=true


i thought, that would solve the problem with the throwing ActivitiOptimisticLockingException Smiley Wink

now I've got the following behavior:

T2_1 and T3_1 are executed in parallel
But then, T2_2 and T3_2 are executed also in parallel (what i do not understand), although exclusive-job is set true

i thought, when exclusive-job is set true, the activity would not be execute in parallel in the same process instance, as i read here:
http://www.activiti.org/userguide/index.html#exclusiveJobs

Since Activiti 5.9, the JobExecutor makes sure that jobs from a single process instance are never executed concurrently.

It would be nice if someone could explain the behavior.

Thanks in advance
Lars Willrich
8 REPLIES 8

frederikherema1
Star Contributor
Star Contributor
Service-Call: async=false, exclusive-job=true

The "exclusive-job=true" makes no sense when the activity is not async. The T2_2 will run right after T2_1 in the same thread. As will T3_2 run right after T3_1. Set the async=true on the *_2 tasks and your issue will be fixed.

larswillrich
Champ in-the-making
Champ in-the-making
The "exclusive-job=true" makes no sense when the activity is not async.

i thought, exclusive-job=true set as default, if its not explicit declared or the async-attribute is set false?

jbarrez
Star Contributor
Star Contributor
Exclusive job = true has only meaning when executing things async. But I can see your point. Tijs has written down some things about it: http://bpmn20inaction.blogspot.be/2012/12/implement-parallel-execution-in-activiti.html

What happens if you make them all async and exclusive?

larswillrich
Champ in-the-making
Champ in-the-making
What happens if you make them all async and exclusive?
all: async and exclusive=true
Then, of course all activities will run sequential (but i want to run T2_1 and T3_1 in parallel)

all activities without T2_1 and T3_1: async=false
T2_1 and T3_1: async = true, exclusive = false
Then, it will throw the ActivitiOptimisticLockingException.

solution:
T1,T4: async = false
T2_1, T3_1: async = true, exclusive = false
T2_2, T3_2: async = true, exclusive = true

Then, T2_1 and T3_1 execute in parallel and after that, it runs sequential again.
Thats the solution for my problem.
Thanks.

regards
Lars

Just a small question - if there is a sub-process (using CallActivity) embedded in a Process definition and on that sub-process, keeping async=false, will there be any difference setting exclusive as false or true ?

trademak
Star Contributor
Star Contributor
No, exclusive only has meaning when async=true

Best regards,

Thanks for the quick reply. The behavior I am trying to understand is - Created a Process Definition with 2 simple Service Tasks & 2 Sub Process (Using CallActivity) and each Sub Process has a Receive Task with a Timer Boundary on it. In this scenario, when the signal is issued on the first Timer Task - the process resumes and continues and when it is about to invoke the Timer in 2nd Sub Process in sequence, it is throwing ActivitiOptimisticLocking Exception on Timer Entity of first SubProcess and the process instance is getting rolled back to the first Time Entity. Trying to understand why this is happening.

jbarrez
Star Contributor
Star Contributor
Do you have a simple process that demonstrates the problem?