How to synchronize using of another workflow variable using beanShell
I have 2 workflow (Main and voting )
when the main workflow generate voting processes
Main contains 2 workflow variables:
voteYes - number of processes(voting workflow) that votes yes
voteNo - number of processes(voting workflow) that votes no
voted - number of voted users
In voting activity
there is only one activity that user vote yer/no then a tool that increment the voted variable and increment voteYes if he choose yes
code:
String count = workflowManager.getProcessVariable(mainProcessId, variableName);
int countInt;
countInt = Integer.parseInt(count) + 1;
count = Integer.toString(countInt);
workflowManager.processVariable(mainProcessId, variableName, count);
the problem:
No synchronization , If 5 users vote together the main variables will not be correct
How to synchronize using of another workflow variable using beanShell
Is there a way to add OS metaphor, Semaphor or Mutex