cancel
Showing results for 
Search instead for 
Did you mean: 

Concurrency Problem

jwalink
Champ in-the-making
Champ in-the-making
Hi all,
I'm doing a proof of concept to see if we use Activiti in my company, I use version 5.14 integrated with Spring, Hibernate (with mysql) and Maven.
I have problems to managing concurrency, when I try obtain a processInstance using the next method: RuntimeService.startProcessInstanceByKey(…)

The problem is fixed if I make "syncronized" that part of the code.
Is it the best way to handle concurrency? is possible to use threads? How could I handle it?
3 REPLIES 3

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi.

Could you create jUnit test for it please?
Template: http://forums.activiti.org/content/sticky-how-write-unit-test

Regards
Martin

frederikherema1
Star Contributor
Star Contributor
What is actually the problem? Multiple threads can call the startProcessByXXX(..) simultaneously without any issue. They will all start a separate process-instance. Do you want to limit the amount of process-instances started for a process-definition?

jwalink
Champ in-the-making
Champ in-the-making
My problem happened because the number of database connections was less than the number of threads opened to execute RuntimeService.startProcessInstanceByKey(…).
Thanks.