Java API - Error when I try to update a variable in each process instance

Hi,

I’m facing an issue in Camunda-ee-7.11 :

  • I need to go thru all the running process instances,
  • I’m using for this the Java API for retrieving all these instances : processEngine.getRuntimeService().createProcessInstanceQuery()…
  • for each instance :
    • I read the variable
    • I change it’s value
    • I put back the new value in the process instance (setVariable())

It works for the 1st instance but then I’ve got an error : ConcurrentModificationException …

I guess that I need to “commit” the change for each process instance …

If someone has an idea, would be great !

Thanks