public Void execute(CommandContext commandContext) { TimerEntity failedJob = (TimerEntity) commandContext .getJobManager() .findJobById(jobId); Date newDueDate = failedJob.calculateRepeat(); if (newDueDate != null) { failedJob.createNewTimerJob(newDueDate); // update configuration of failed job TimerJobConfiguration config = (TimerJobConfiguration) failedJob.getJobHandlerConfiguration(); config.setFollowUpJobCreated(true); failedJob.setJobHandlerConfiguration(config); } return null; }
public Void execute(CommandContext commandContext) { TimerEntity failedJob = (TimerEntity) commandContext .getJobManager() .findJobById(jobId); Date newDueDate = failedJob.calculateRepeat(); if (newDueDate != null) { failedJob.createNewTimerJob(newDueDate); // update configuration of failed job TimerJobConfiguration config = (TimerJobConfiguration) failedJob.getJobHandlerConfiguration(); config.setFollowUpJobCreated(true); failedJob.setJobHandlerConfiguration(config); } return null; }
@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); } } } }
@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); } } } }
public Void execute(CommandContext commandContext) { TimerEntity failedJob = (TimerEntity) commandContext .getJobManager() .findJobById(jobId); Date newDueDate = failedJob.calculateRepeat(); if (newDueDate != null) { failedJob.createNewTimerJob(newDueDate); // update configuration of failed job TimerJobConfiguration config = (TimerJobConfiguration) failedJob.getJobHandlerConfiguration(); config.setFollowUpJobCreated(true); failedJob.setJobHandlerConfiguration(config); } return null; }
@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); } } } }