Is multi-instance activity thread-safe?

For example, I have a variable with type HashMap that I created before my process entered multi-instance activity. I want to use parallel execution. Activity do some logic, and I need to put the result of each execution into the map.

Will the process run without an errors, for example - ConcurrentModificationException?

@Markwart it depends on what operation and which data structures you’re using it to implement the logic. for example, in service task the delegates which you implement (your business logic) might throw those exceptions if it not properly handled. Other than that, in camunda api’s are handled those scenarios.

The most important thing is there’s possibilities for OptimisticLlockingException can occur in parallel gateways/multi-instance activities when you update the variables in full visibility scope. Than can be solved by marking the activities as exclusive=true will solve that issue

2 Likes