use of org.camunda.bpm.engine.impl.jobexecutor.TimerEventJobHandler in project camunda-bpm-platform by camunda.
the class TimerEntity method preExecute.
@Override
protected void preExecute(CommandContext commandContext) {
if (getJobHandler() instanceof TimerEventJobHandler) {
TimerJobConfiguration configuration = (TimerJobConfiguration) getJobHandlerConfiguration();
if (repeat != null && !configuration.isFollowUpJobCreated()) {
// this timer is a repeating timer and
// a follow up timer job has not been scheduled yet
Date newDueDate = calculateRepeat();
if (newDueDate != null) {
// the listener is added to the transaction as SYNC on ROLLABCK,
// when it is necessary to schedule a new timer job invocation.
// If the transaction does not rollback, it is ignored.
ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequiresNew();
RepeatingFailedJobListener listener = createRepeatingFailedJobListener(commandExecutor);
commandContext.getTransactionContext().addTransactionListener(TransactionState.ROLLED_BACK, listener);
// create a new timer job
createNewTimerJob(newDueDate);
}
}
}
}
Aggregations