4 Replies Latest reply on Jul 27, 2007 4:11 PM by meet_nagi

    Concurrent Processing in JBPM

    meet_nagi

      I am new to JBPM and have a question on concurrent processing handled by JBPM.
      Below is the block of code showing my usage of JBPM

      // Get the JBPMContext
      jbpmContext = getJBPMContext();
      // Get the process instance for the process instance id passed.

      ProcessInstance processInstance = jbpmContext.loadProcessInstance(processInstanceId);
      Token token = processInstance.getRootToken();
      token.signal();
      jbpmContext.save(token);
      jbpmContext.save(processInstance);

      My question is before transaction A issues an explicit save another transaction B modifies the same records then how JBPM will handle transaction A?

      I hope I will get answre to my question.

      Thanks

        • 1. Re: Concurrent Processing in JBPM

          This is a short question with a really LOOONG answer - several pages long.

          The answer depends on the database you're using, what transaction isolation you've specified, and, most importantly, the specific concurrency scenario you're thinking of.

          To see what I mean about the scenario, consider the case you presented. The only record modified was the token. Under what conditions would another transaction be concurrently modifying the same token? Very few - the only one I can think of is some sort of intervention, like someone killing the process. I'm not sure, but I think I remember seeing specific code to deal with this concurrency scenario in JBPM.

          So there's no general answer - only specific ones, which have to be considered in the context of the database and configuration.

          There are some specific areas that are believed to be buggy (at least in some db/transaction/container configurations), dealing with:
          - race conditions at join nodes
          - race conditions at return from a subprocess
          - race conditions with asynchronous agents trying to interact with a process instance soon after start - typically an MDB trying to interact with the process.

          I believe these are being worked on.

          -Ed Staub

          • 2. Re: Concurrent Processing in JBPM
            kukeltje

            Great summary Ed,

            Regards,

            Ronald (on it's way from Petra to Distant Heat, a good reason for not being able to post some days :-) )

            • 3. Re: Concurrent Processing in JBPM

              Ronald,

              Thanks, stay cool, have fun!

              -Ed

              • 4. Re: Concurrent Processing in JBPM
                meet_nagi

                Thanks much.