I am using jbpm to produce a bit of software that allows 3 different people to work on a process instance concurrently. Each of these roles have different things they can do to the process instance and they can work concurrently on a single process instance.
My process graph has 3 different branches corresponding to the roles. A new token is created for each of the role types. At the start the tokens traverse to the appropriate bit of the process graph for them.
Most of the time these three parts of the process graph don't interact. So a user in a role just merrily closes task related to him/makes traversals to other nodes that concern him. Basically all three tokens (threads) run until the process instance is destroyed. There is no joining of the tokens.
My problem is that occasionally there must be some communication between the 3 threads. For example the first token wants to signal the second token into a certain state on completion of some work. On another occassion they want to share info in the contextinstance.
The concurrency issues really worry me. For example if someone is working token two via a UI driven client however at the same time token one wants to move thread two into a different state. This could result in a race condition. Thread one updates could be lost.
Any thoughts on how I could have multiple threads running over a process graph. Then periodically I want to be able to synchronize them (perhaps put them into a node with no transitions)? Then I want to perform some action. Then I want to return the tokens to the nodes they were at and return them to running as if nothing had happened.
Could anyone outline how the join node works and how it's synchronization is accomplished? Perhaps that will provide a clue.
thanks in advance!