* Execute the command.
* @param jbpmContext The jBPM context associated with the execution.
* @throws Exception for errors during execution.
*/
public Object execute(JbpmContext jbpmContext) throws Exception {
Job job = acquireJob(jbpmContext);
if (JobUtil.isDeleted(job)) {
if (log.isDebugEnabled()) {
log.debug("job " + jobId + " was deleted");
}
return null;
}
if (job.isSuspended()) {
if (log.isDebugEnabled()) {
log.debug(job + " is suspended");
}
RetryExecutor.handleSuspendedJob(job) ;
return null ;
}
if (redelivered) {
if (job.getRetries() > 0) {
job.setRetries(job.getRetries() - 1);
if (log.isDebugEnabled()) {
log.debug("Rescheduling job " + job.getId());
}
job.setLockOwner(null) ;
jbpmContext.getServices().getMessageService().send(job) ;
} else {
log.error("Job retry count exceeded for job " + job.getId());
}
return null ;
}
executeJob(job, jbpmContext);
return job;