cancel
Showing results for 
Search instead for 
Did you mean: 

Executing subprocess single threadedly

gsbakshi
Champ in-the-making
Champ in-the-making
Hi,

I have an Activiti process defined with one serviceTask followed by one subProcess. As I understand, when multiple users perform this process, Acitviti will create a new thread for each user request to execute the process. My issue is that I can have the serviceTask executed concurrently for each user request however the sub-process should not be executed by more than one thread at a given time i.e. if one user request has started executing the subProcess then other user requests should wait till the first request has been completed (either successfully or with exception).

I have gone through the documentation and also Activiti.in.Action.pdf but could not find anything in this regard.

Please let me know what are the possible alternatives to meet this requirement.

Thanks.

Gurpreet
4 REPLIES 4

gsbakshi
Champ in-the-making
Champ in-the-making
Looking for a  solution to handle it declaratively in XML itself if possible.

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Gurpreet,

I would suggest to:
1. make subprocess asynchronous
2. Change jobExecutor to execute this subprocess sequentially.

Regards
Martin

Thanks Martin for your response.

Since I am fairly new to Activiti, can you please elaborate on point#2 i.e. how it can be achieved?

Regards

Gurpreet

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Gurpreet,

1. make subprocess asynchronous

just change your process model.

2. Change jobExecutor to execute this subprocess sequentially.
You have to re-implement Default job executor to execute given subprocesses in one thread only. (I did not find an example in the source code - you have to debug current implementation little bit)

Regards
Martin