7 Replies Latest reply on Dec 17, 2007 4:45 AM by Ronald van Kuijk

    how to merge global variables value in a JOIN

    Thomas Sandor Newbie

      Hi,
      I've seen the pattern "WPF3: Synchronization" and checked the test case "Wfp03SynchronizationTest" in jBPM3.1.4.

      However, this workflow situtation is pretty straight forward, I cannot image how to extend it when there's also data with the workflow.

      E.g. let's see the jpdl in the testcase:

      <process-definition>
       <start-state name='start'>
       <transition to='fork' />
       </start-state>
       <fork name='fork'>
       <transition name='first' to='one' />
       <transition name='second' to='two' />
       </fork>
       <state name='one'>
       <transition to='join' />
       </state>
       <state name='two'>
       <transition to='join' />
       </state>
       <join name='join'>
       <transition to='end' />
       </join>
       <end-state name='end' />
      </process-definition>
      


      What if I have a String context variable named "str" with value "start" in start-state, and modify it in "state one" and "state two", str="one" and str="two" respectively.

      What will be the value at the end after the join?

      Will the "fork" make replicas of context variables when doing the fork, so that global values will not be overloaded in "state one" nor in "state two" in the same time? I guess, making replicas is necessary, because a variable modified in "state one" cannot be seen in "state two", since the later may also modify (and thus it would overload) the value of same variable.
      If so, how will "join" merge these variable replicas? What will be the final context variable value?

      Thanks for your help.
      --
      Thomas