07-23-2012 10:21 PM
public void executeJobs(List<String> jobIds) {
try {
threadPoolExecutor.execute(new ExecuteJobsRunnable(this, jobIds));
}catch (RejectedExecutionException e) {
rejectedJobsHandler.jobsRejected(this, jobIds);
}
}
The paramenter jobIds has tow data, and I checked the db, the tow job ids just represent the task1 and task2. So in my opinion, the tow tasks are executed in one process, Is that true?<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration">
<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/act2" />
<property name="jdbcDriver" value="com.mysql.jdbc.Driver" />
<property name="jdbcUsername" value="act" />
<property name="jdbcPassword" value="act" />
<!– Database configurations –>
<property name="databaseSchemaUpdate" value="true" />
<!– job executor configurations –>
<property name="jobExecutorActivate" value="true" />
<!– mail server configurations –>
<property name="mailServerPort" value="5025" />
</bean>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="definitions"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti="http://activiti.org/bpmn"
targetNamespace="Examples">
<process id="test">
<startEvent id="start" />
<parallelGateway id="fork" />
<sequenceFlow id="flow1" sourceRef="start" targetRef="fork" />
<serviceTask id="task1" name="Task1" activiti:async="true" activiti:class="psn.wxf.test.paralleltest.Task1" />
<serviceTask id="task2" name="Task2" activiti:async="true" activiti:class="psn.wxf.test.paralleltest.Task2" />
<sequenceFlow id="flow2" sourceRef="fork" targetRef="task1" />
<sequenceFlow id="flow3" sourceRef="fork" targetRef="task2" />
<parallelGateway id="join" />
<sequenceFlow id="flow4" sourceRef="task1" targetRef="join" />
<sequenceFlow id="flow5" sourceRef="task2" targetRef="join" />
<serviceTask id="task3" name="Task3" activiti:class="psn.wxf.test.paralleltest.Task3" />
<sequenceFlow id="flow7" sourceRef="join" targetRef="task3" />
<sequenceFlow id="flow8" sourceRef="task3" targetRef="theEnd" />
<endEvent id="theEnd" />
</process>
</definitions>
public class Task1 implements JavaDelegate {
@Override
public void execute(DelegateExecution execution) throws Exception {
for(int i=0;i<100;i++) {
if (i==50) Thread.sleep(1000);
System.out.println("Task1:"+i);
}
}
}
my task2 java classpublic class Task2 implements JavaDelegate {
@Override
public void execute(DelegateExecution execution) throws Exception {
for(int j=0;j<10;j++) {
if (j==5) {
j=5;
}
System.out.println("Task2:"+j);
}
}
}
public class EngineTest {
public static void main(String[] args) {
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
RepositoryService repositoryService = processEngine
.getRepositoryService();
RuntimeService runtimeService = processEngine.getRuntimeService();
runtimeService.startProcessInstanceByKey("test");
processEngine.close();
}
}
07-24-2012 03:15 AM
07-24-2012 04:22 AM
07-24-2012 05:29 AM
07-24-2012 05:51 AM
07-24-2012 07:16 AM
07-24-2012 09:28 AM
07-24-2012 09:30 AM
07-25-2012 03:29 AM
org.activiti.engine.ActivitiOptimisticLockingException: ExecutionEntity[6201] was updated by another transaction concurrently
07-25-2012 03:10 PM
Ronald, I'm not aware of this kind of mechanism being in place, but you can be right though…
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.