Beginner's Corner looks not the right place to get an answer for this, I move it to a better place
Yes, multiple processes can be executed in parallel.
The easiest way to use a runtime manager with a strategy per request or per process instance, which will instantiate a different ksession per request / per process instance, and there requests will be executed in parallel. See Chapter 5. Core Engine API
When only using one ksession , this will also be achieved by using asynchronous service tasks (same way as for example human tasks are executed). This will execute the service task using independent threads. As a result, other requests can be executed while waiting for the results of the first. You can use the jBPM executor for setting up asynchronous service tasks.
thanks for the reply.
i created a simple process that has just one script task using the jbpm console . i have added a sleep in the script task so that process execution takes more than 25 seconds.
i created the deployment to use PER_REQUEST runtime strategy.
now i opened 2 separate command line windows to start 2 instances of the process in parallel:
curl -X POST -H "Accept:application/json" -u admin:admin http://localhost:8080/jbpm-console/rest/runtime/vrts.vom.plans:recoveryplan:1.0/process/recoveryplan.rplan/start
when i start the second instance using the same command in another window (before the first instance completes) i m getting the following exception:-
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<error>org.hibernate.exception.GenericJDBCException: Timeout trying to lock table "PROCESSINSTANCEINFO"; SQL statement:
insert into ProcessInstanceInfo (InstanceId, lastModificationDate, lastReadDate, processId, processInstanceByteArray, startDate, state, OPTLOCK) values (null, ?, ?, ?, ?, ?, ?, ?) [50200-161]</error>
<stackTrace>javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Timeout trying to lock table "PROCESSINSTANCEINFO"; SQL statement:
insert into ProcessInstanceInfo (InstanceId, lastModificationDate, lastReadDate, processId, processInstanceByteArray, startDate, state, OPTLOCK) values (null, ?, ?, ?, ?, ?, ?, ?) [50200-161]
Looks like it is timing out while locking table PROCESSINSTANCEINFO. i was hoping to see them both executed in parallel. what am i missing?
observed the same behavior with PER_PROCESS_INSTANCE runtime strategy as well.
Depending on what database configuration you use, you might have to add an index on the process instance info table (column id) to avoid it to lock the entire process instance info table.
i m using the default database that comes with the demo setup. does it not support row level locking?
Indexes are not always created when auto-generating the database (depending on the database etc.). For these types of tests, it would be recommended to use a more realistic production database (not pure in memory), which will allow you to add indexes if necessary.