Search in sources :

Example 1 with JobHandler

use of org.camunda.bpm.engine.impl.jobexecutor.JobHandler in project camunda-bpm-platform by camunda.

the class JobEntity method execute.

public void execute(CommandContext commandContext) {
    if (executionId != null) {
        ExecutionEntity execution = getExecution();
        ensureNotNull("Cannot find execution with id '" + executionId + "' referenced from job '" + this + "'", "execution", execution);
    }
    // initialize activity id
    getActivityId();
    // increment sequence counter before job execution
    incrementSequenceCounter();
    preExecute(commandContext);
    JobHandler jobHandler = getJobHandler();
    JobHandlerConfiguration configuration = getJobHandlerConfiguration();
    ensureNotNull("Cannot find job handler '" + jobHandlerType + "' from job '" + this + "'", "jobHandler", jobHandler);
    jobHandler.execute(configuration, execution, commandContext, tenantId);
    postExecute(commandContext);
}
Also used : JobHandler(org.camunda.bpm.engine.impl.jobexecutor.JobHandler) JobHandlerConfiguration(org.camunda.bpm.engine.impl.jobexecutor.JobHandlerConfiguration)

Example 2 with JobHandler

use of org.camunda.bpm.engine.impl.jobexecutor.JobHandler in project camunda-bpm-platform by camunda.

the class ProcessEngineConfigurationImpl method initJobExecutor.

// job executor /////////////////////////////////////////////////////////////
protected void initJobExecutor() {
    if (jobExecutor == null) {
        jobExecutor = new DefaultJobExecutor();
    }
    jobHandlers = new HashMap<String, JobHandler>();
    TimerExecuteNestedActivityJobHandler timerExecuteNestedActivityJobHandler = new TimerExecuteNestedActivityJobHandler();
    jobHandlers.put(timerExecuteNestedActivityJobHandler.getType(), timerExecuteNestedActivityJobHandler);
    TimerCatchIntermediateEventJobHandler timerCatchIntermediateEvent = new TimerCatchIntermediateEventJobHandler();
    jobHandlers.put(timerCatchIntermediateEvent.getType(), timerCatchIntermediateEvent);
    TimerStartEventJobHandler timerStartEvent = new TimerStartEventJobHandler();
    jobHandlers.put(timerStartEvent.getType(), timerStartEvent);
    TimerStartEventSubprocessJobHandler timerStartEventSubprocess = new TimerStartEventSubprocessJobHandler();
    jobHandlers.put(timerStartEventSubprocess.getType(), timerStartEventSubprocess);
    AsyncContinuationJobHandler asyncContinuationJobHandler = new AsyncContinuationJobHandler();
    jobHandlers.put(asyncContinuationJobHandler.getType(), asyncContinuationJobHandler);
    ProcessEventJobHandler processEventJobHandler = new ProcessEventJobHandler();
    jobHandlers.put(processEventJobHandler.getType(), processEventJobHandler);
    TimerSuspendProcessDefinitionHandler suspendProcessDefinitionHandler = new TimerSuspendProcessDefinitionHandler();
    jobHandlers.put(suspendProcessDefinitionHandler.getType(), suspendProcessDefinitionHandler);
    TimerActivateProcessDefinitionHandler activateProcessDefinitionHandler = new TimerActivateProcessDefinitionHandler();
    jobHandlers.put(activateProcessDefinitionHandler.getType(), activateProcessDefinitionHandler);
    TimerSuspendJobDefinitionHandler suspendJobDefinitionHandler = new TimerSuspendJobDefinitionHandler();
    jobHandlers.put(suspendJobDefinitionHandler.getType(), suspendJobDefinitionHandler);
    TimerActivateJobDefinitionHandler activateJobDefinitionHandler = new TimerActivateJobDefinitionHandler();
    jobHandlers.put(activateJobDefinitionHandler.getType(), activateJobDefinitionHandler);
    BatchSeedJobHandler batchSeedJobHandler = new BatchSeedJobHandler();
    jobHandlers.put(batchSeedJobHandler.getType(), batchSeedJobHandler);
    BatchMonitorJobHandler batchMonitorJobHandler = new BatchMonitorJobHandler();
    jobHandlers.put(batchMonitorJobHandler.getType(), batchMonitorJobHandler);
    HistoryCleanupJobHandler historyCleanupJobHandler = new HistoryCleanupJobHandler();
    jobHandlers.put(historyCleanupJobHandler.getType(), historyCleanupJobHandler);
    for (JobHandler batchHandler : batchHandlers.values()) {
        jobHandlers.put(batchHandler.getType(), batchHandler);
    }
    // if we have custom job handlers, register them
    if (getCustomJobHandlers() != null) {
        for (JobHandler customJobHandler : getCustomJobHandlers()) {
            jobHandlers.put(customJobHandler.getType(), customJobHandler);
        }
    }
    jobExecutor.setAutoActivate(jobExecutorActivate);
    if (jobExecutor.getRejectedJobsHandler() == null) {
        if (customRejectedJobsHandler != null) {
            jobExecutor.setRejectedJobsHandler(customRejectedJobsHandler);
        } else {
            jobExecutor.setRejectedJobsHandler(new NotifyAcquisitionRejectedJobsHandler());
        }
    }
}
Also used : DefaultJobExecutor(org.camunda.bpm.engine.impl.jobexecutor.DefaultJobExecutor) BatchSeedJobHandler(org.camunda.bpm.engine.impl.batch.BatchSeedJobHandler) ProcessEventJobHandler(org.camunda.bpm.engine.impl.jobexecutor.ProcessEventJobHandler) TimerActivateJobDefinitionHandler(org.camunda.bpm.engine.impl.jobexecutor.TimerActivateJobDefinitionHandler) NotifyAcquisitionRejectedJobsHandler(org.camunda.bpm.engine.impl.jobexecutor.NotifyAcquisitionRejectedJobsHandler) TimerStartEventSubprocessJobHandler(org.camunda.bpm.engine.impl.jobexecutor.TimerStartEventSubprocessJobHandler) TimerSuspendJobDefinitionHandler(org.camunda.bpm.engine.impl.jobexecutor.TimerSuspendJobDefinitionHandler) AsyncContinuationJobHandler(org.camunda.bpm.engine.impl.jobexecutor.AsyncContinuationJobHandler) ModificationBatchJobHandler(org.camunda.bpm.engine.impl.ModificationBatchJobHandler) DeleteProcessInstancesJobHandler(org.camunda.bpm.engine.impl.batch.deletion.DeleteProcessInstancesJobHandler) BatchJobHandler(org.camunda.bpm.engine.impl.batch.BatchJobHandler) HistoryCleanupJobHandler(org.camunda.bpm.engine.impl.jobexecutor.historycleanup.HistoryCleanupJobHandler) TimerStartEventJobHandler(org.camunda.bpm.engine.impl.jobexecutor.TimerStartEventJobHandler) DeleteHistoricDecisionInstancesJobHandler(org.camunda.bpm.engine.impl.dmn.batch.DeleteHistoricDecisionInstancesJobHandler) UpdateProcessInstancesSuspendStateJobHandler(org.camunda.bpm.engine.impl.batch.update.UpdateProcessInstancesSuspendStateJobHandler) SetExternalTaskRetriesJobHandler(org.camunda.bpm.engine.impl.batch.externaltask.SetExternalTaskRetriesJobHandler) SetJobRetriesJobHandler(org.camunda.bpm.engine.impl.batch.job.SetJobRetriesJobHandler) TimerExecuteNestedActivityJobHandler(org.camunda.bpm.engine.impl.jobexecutor.TimerExecuteNestedActivityJobHandler) BatchMonitorJobHandler(org.camunda.bpm.engine.impl.batch.BatchMonitorJobHandler) RestartProcessInstancesJobHandler(org.camunda.bpm.engine.impl.RestartProcessInstancesJobHandler) BatchSeedJobHandler(org.camunda.bpm.engine.impl.batch.BatchSeedJobHandler) MigrationBatchJobHandler(org.camunda.bpm.engine.impl.migration.batch.MigrationBatchJobHandler) DeleteHistoricProcessInstancesJobHandler(org.camunda.bpm.engine.impl.batch.deletion.DeleteHistoricProcessInstancesJobHandler) TimerStartEventSubprocessJobHandler(org.camunda.bpm.engine.impl.jobexecutor.TimerStartEventSubprocessJobHandler) ProcessEventJobHandler(org.camunda.bpm.engine.impl.jobexecutor.ProcessEventJobHandler) TimerCatchIntermediateEventJobHandler(org.camunda.bpm.engine.impl.jobexecutor.TimerCatchIntermediateEventJobHandler) JobHandler(org.camunda.bpm.engine.impl.jobexecutor.JobHandler) TimerActivateProcessDefinitionHandler(org.camunda.bpm.engine.impl.jobexecutor.TimerActivateProcessDefinitionHandler) BatchMonitorJobHandler(org.camunda.bpm.engine.impl.batch.BatchMonitorJobHandler) HistoryCleanupJobHandler(org.camunda.bpm.engine.impl.jobexecutor.historycleanup.HistoryCleanupJobHandler) TimerCatchIntermediateEventJobHandler(org.camunda.bpm.engine.impl.jobexecutor.TimerCatchIntermediateEventJobHandler) TimerSuspendProcessDefinitionHandler(org.camunda.bpm.engine.impl.jobexecutor.TimerSuspendProcessDefinitionHandler) TimerStartEventJobHandler(org.camunda.bpm.engine.impl.jobexecutor.TimerStartEventJobHandler) TimerExecuteNestedActivityJobHandler(org.camunda.bpm.engine.impl.jobexecutor.TimerExecuteNestedActivityJobHandler) AsyncContinuationJobHandler(org.camunda.bpm.engine.impl.jobexecutor.AsyncContinuationJobHandler)

Example 3 with JobHandler

use of org.camunda.bpm.engine.impl.jobexecutor.JobHandler in project camunda-bpm-platform by camunda.

the class EverLivingJobEntity method init.

@Override
public void init(CommandContext commandContext) {
    // clean additional data related to this job
    JobHandler jobHandler = getJobHandler();
    if (jobHandler != null) {
        jobHandler.onDelete(getJobHandlerConfiguration(), this);
    }
    // cancel the retries -> will resolve job incident if present
    setRetries(commandContext.getProcessEngineConfiguration().getDefaultNumberOfRetries());
    // delete the job's exception byte array and exception message
    String exceptionByteArrayIdToDelete = null;
    if (exceptionByteArrayId != null) {
        exceptionByteArrayIdToDelete = exceptionByteArrayId;
        this.exceptionByteArrayId = null;
        this.exceptionMessage = null;
    }
    // clean the lock information
    setLockOwner(null);
    setLockExpirationTime(null);
    if (exceptionByteArrayIdToDelete != null) {
        ByteArrayEntity byteArray = commandContext.getDbEntityManager().selectById(ByteArrayEntity.class, exceptionByteArrayIdToDelete);
        commandContext.getDbEntityManager().delete(byteArray);
    }
}
Also used : JobHandler(org.camunda.bpm.engine.impl.jobexecutor.JobHandler)

Example 4 with JobHandler

use of org.camunda.bpm.engine.impl.jobexecutor.JobHandler in project camunda-bpm-platform by camunda.

the class JobEntity method delete.

public void delete(boolean incidentResolved) {
    CommandContext commandContext = Context.getCommandContext();
    incrementSequenceCounter();
    // clean additional data related to this job
    JobHandler jobHandler = getJobHandler();
    if (jobHandler != null) {
        jobHandler.onDelete(getJobHandlerConfiguration(), this);
    }
    // fire delete event if this job is not being executed
    boolean executingJob = this.equals(commandContext.getCurrentJob());
    commandContext.getJobManager().deleteJob(this, !executingJob);
    // Also delete the job's exception byte array
    if (exceptionByteArrayId != null) {
        commandContext.getByteArrayManager().deleteByteArrayById(exceptionByteArrayId);
    }
    // remove link to execution
    ExecutionEntity execution = getExecution();
    if (execution != null) {
        execution.removeJob(this);
    }
    removeFailedJobIncident(incidentResolved);
}
Also used : JobHandler(org.camunda.bpm.engine.impl.jobexecutor.JobHandler) CommandContext(org.camunda.bpm.engine.impl.interceptor.CommandContext)

Aggregations

JobHandler (org.camunda.bpm.engine.impl.jobexecutor.JobHandler)4 ModificationBatchJobHandler (org.camunda.bpm.engine.impl.ModificationBatchJobHandler)1 RestartProcessInstancesJobHandler (org.camunda.bpm.engine.impl.RestartProcessInstancesJobHandler)1 BatchJobHandler (org.camunda.bpm.engine.impl.batch.BatchJobHandler)1 BatchMonitorJobHandler (org.camunda.bpm.engine.impl.batch.BatchMonitorJobHandler)1 BatchSeedJobHandler (org.camunda.bpm.engine.impl.batch.BatchSeedJobHandler)1 DeleteHistoricProcessInstancesJobHandler (org.camunda.bpm.engine.impl.batch.deletion.DeleteHistoricProcessInstancesJobHandler)1 DeleteProcessInstancesJobHandler (org.camunda.bpm.engine.impl.batch.deletion.DeleteProcessInstancesJobHandler)1 SetExternalTaskRetriesJobHandler (org.camunda.bpm.engine.impl.batch.externaltask.SetExternalTaskRetriesJobHandler)1 SetJobRetriesJobHandler (org.camunda.bpm.engine.impl.batch.job.SetJobRetriesJobHandler)1 UpdateProcessInstancesSuspendStateJobHandler (org.camunda.bpm.engine.impl.batch.update.UpdateProcessInstancesSuspendStateJobHandler)1 DeleteHistoricDecisionInstancesJobHandler (org.camunda.bpm.engine.impl.dmn.batch.DeleteHistoricDecisionInstancesJobHandler)1 CommandContext (org.camunda.bpm.engine.impl.interceptor.CommandContext)1 AsyncContinuationJobHandler (org.camunda.bpm.engine.impl.jobexecutor.AsyncContinuationJobHandler)1 DefaultJobExecutor (org.camunda.bpm.engine.impl.jobexecutor.DefaultJobExecutor)1 JobHandlerConfiguration (org.camunda.bpm.engine.impl.jobexecutor.JobHandlerConfiguration)1 NotifyAcquisitionRejectedJobsHandler (org.camunda.bpm.engine.impl.jobexecutor.NotifyAcquisitionRejectedJobsHandler)1 ProcessEventJobHandler (org.camunda.bpm.engine.impl.jobexecutor.ProcessEventJobHandler)1 TimerActivateJobDefinitionHandler (org.camunda.bpm.engine.impl.jobexecutor.TimerActivateJobDefinitionHandler)1 TimerActivateProcessDefinitionHandler (org.camunda.bpm.engine.impl.jobexecutor.TimerActivateProcessDefinitionHandler)1