3 Replies Latest reply on Aug 31, 2007 11:52 AM by Luca Tagliani

    Synchronization problem

    Luca Tagliani Newbie

      Hi all,
      we are developing an application using jBPM.
      This application has a scheduler that instances jBPM processes in different thread.
      These processes are long term automatic processes (made of several 'node' step each with an actionHandler) which spans several minutes.
      When in one of the step the actionHandler raise an exception, we suspend and save the process instance.

      We then develop a console that query the jBPM engine to find the suspended processes, in order to resume or kill the execution.

      The problem we have is this: when we call findProcessInstances() to retrieve the process instances from the database, jBPM did not responds until all the process in execution ends or is suspended.

      It seems that there is a problem of concurrence in the database access.

      We didn't find any advice to solve this.

      Any help would be appreciated.

      Thanks in advance


        • 1. Re: Synchronization problem
          Edward Staub Expert

          The state of a process is not saved until there is nothing left to do, and the JbpmContext is closed. This typically happens under 3 conditions:
          - encountering a node marked "async"
          - completion of the process
          - the process is completely blocked, waiting for external stimuli to resume. These may be user actions, timers, JMS messages, or whatever.

          If you want the state committed more frequently than it is, the easiest way is to mark nodes "async". This flushes all process data to the database and then reloads before the node's action is performed.

          -Ed Staub

          • 2. Re: Synchronization problem
            Luca Tagliani Newbie

            Thanks Ed for your reply.

            We have tried to mark as "async" the nodes of the process, but then the process itself did not execute the action associated to the node.

            We didn't make any modification to the jBPM configuration for the async execution.

            Perhaps we need to do something in that direction?


            • 3. Re: Synchronization problem
              Luca Tagliani Newbie

              We found the solution.
              At the start of our main() now we call JbpmConfiguration.getInstance().startJobExecutor().

              We've missed this method.... :-)

              Thanks all