2 Replies Latest reply on Mar 31, 2006 2:32 PM by jboarhat

    jBPM and Concurrency

    jboarhat

      I know this subject has come up numerous times on these forums, but none of the posts has the exact answer I'm looking for. I understand that jBPM implements concurrency at a business process level, not in terms of real (i.e. threaded) concurrent execution. Would it be possible to implement threads that run actual process instances rather than creating threads within a process instance. We are trying to utilize jBPM as a workflow tool to coordinate and run several actions that do not depend on user intervention unless an error occurs.

      While we don't want to create threads within the process instances themselves, we do want to be able to create and execute multiple process instances concurrently. These process instances may use different process definitions, or there may be multiple instances running with the same definition. To accomplish this, the JbpmContext and JbpmConfiguration would need to be threadsafe. I know process instances are not threadsafe, but I'm hoping that there is some way to make the workflow engine do more than one thing at a time.

      Any thoughts or opinions on this would be most helpful.

      Thanks

        • 1. Re: jBPM and Concurrency
          aguizar

          jBPM executes in the client thread. How you create that thread is up to you. Here are some facts for you to consider:
          JbpmConfiguration is threadsafe, mostly because it is read-only :-) If you find it is not, please report the problem here.
          Conversely, JbpmContext is designed to be used as a thread-local object, so it is not threadsafe.
          Once you create your threads, you can retrieve the JbpmConfiguration from any of them with a call to JbpmConfiguration.getInstance()
          When you call openJbpmContext() on the JbpmConfiguration instance, the returned JbpmContext will be associated to the thread where the invocation ocurred.
          You can access the JbpmContext associated with the current thread anytime by invoking JbpmContext.getCurrentJbpmContext()

          • 2. Re: jBPM and Concurrency
            jboarhat

            This is exactly the information I was looking for.

            Thank you very much for your help.