Hi,sometimes ActivitiOptimisticLockingException's like
VariableInstanceEntity[id=99, name=nrOfCompletedInstances, type=integer, longValue=1, textValue=1] was updated by another transaction concurrently
occur and the hole process is stalled until the job ist executed again. Reducing lockTimeInMillis isn't an option, so is it safe to extend the ExecuteJobsRunnable class to allow an immediate second attempt ?
final List<String> failedJobs = new ArrayList<String>();
…
while (!currentProcessorJobQueue.isEmpty()) {
String job = currentProcessorJobQueue.remove(0);
try {
commandExecutor.execute(new ExecuteJobsCmd(job));
}
catch( ActivitiOptimisticLockingException ex)
{
if( ! failedJobs.contains(job)){
if (!currentProcessorJobQueue.isEmpty()) {
currentProcessorJobQueue.add(0, job);
} else {
currentProcessorJobQueue.add(job);
}
log.info("ActivitiOptimisticLockingException job:" +job+ ", retry");
failedJobs.add(job);
}
}
catch (Throwable e) {
…
Thanks-kai