cancel
Showing results for 
Search instead for 
Did you mean: 

Async job are not locked in clustered applications.

victor1
Champ in-the-making
Champ in-the-making
Good afternoon!

I use two applications in a cluster.
JobExecutors configured as follows:

1 JobExecutor:

<property name="jobExecutor" ref="jobExecutor" />
<property name="jobExecutorActivate" value="false" />
<property name="asyncExecutor" ref="asyncExecutor" />
<property name="asyncExecutorEnabled" value="true" />
<property name="asyncExecutorActivate" value="true" />
<property name="defaultFailedJobWaitTime" value="1" />
<property name="asyncFailedJobWaitTime" value="1" />
<property name="history" value="full" />
<property name="dbIdentityUsed" value="false" />
<property name="dbHistoryUsed" value="true" />

<bean id="jobExecutor" class="org.activiti.engine.impl.jobexecutor.DefaultJobExecutor">
   <property name="corePoolSize" value="25" />
   <property name="maxPoolSize" value="50" />
   <property name="keepAliveTime" value="3000" />
   <property name="queueSize" value="200" />
   <property name="lockTimeInMillis" value="5000" />
   <property name="lockOwner" value="app1" />
   <property name="maxJobsPerAcquisition" value="1" />
</bean>


2 JobExecutor:

<property name="jobExecutor" ref="jobExecutor" />
<property name="jobExecutorActivate" value="false" />
<property name="asyncExecutor" ref="asyncExecutor" />
<property name="asyncExecutorEnabled" value="true" />
<property name="asyncExecutorActivate" value="true" />
<property name="defaultFailedJobWaitTime" value="1" />
<property name="asyncFailedJobWaitTime" value="1" />
<property name="history" value="full" />
<property name="dbIdentityUsed" value="false" />
<property name="dbHistoryUsed" value="true" />

<bean id="jobExecutor" class="org.activiti.engine.impl.jobexecutor.DefaultJobExecutor">
   <property name="corePoolSize" value="25" />
   <property name="maxPoolSize" value="50" />
   <property name="keepAliveTime" value="3000" />
   <property name="queueSize" value="200" />
   <property name="lockTimeInMillis" value="5000" />
   <property name="lockOwner" value="app2" />
   <property name="maxJobsPerAcquisition" value="1" />
</bean>


If i start two applications in a cluster with a single database where all nodes are located on different servers,
one application performs its own jobs, and the other performs its own jobs and jobs of the first application.

If I start all nodes in the cluster on 1 server (ie, two applications and the database with which they work are on one server), everything works fine.
All jobs locked and executed correctly.

Applications are the same.

Network delay may well affect the operation of applications?
Is there any setting in the Activiti to deal with this problem?
3 REPLIES 3

trademak
Star Contributor
Star Contributor
Is there a time difference in the system clocks between these servers?

Best regards,

victor1
Champ in-the-making
Champ in-the-making
Yes, its about 1,5 min difference.
Can i fix this with
<code>
<property name="keepAliveTime" value="3000" />
<property name="lockTimeInMillis" value="5000" />
</code>
Maybe i should increase these values?

trademak
Star Contributor
Star Contributor
1,5 min difference is a lot. Isn't it possible to keep the clocks in sync?
You can read about the configuration options here:

http://activiti.org/userguide/index.html#_async_executor_configuration

Best regards,