Class DefaultJobManager
java.lang.Object
org.activiti.engine.impl.asyncexecutor.DefaultJobManager
- All Implemented Interfaces:
JobManager
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultJobManager(ProcessEngineConfigurationImpl processEngineConfiguration) -
Method Summary
Modifier and TypeMethodDescriptionTransforms aSuspendedJobEntityback to anAbstractJobEntity(i.e. to what it was originally).protected intcalculateMaxIterationsValue(String originalExpression) protected AbstractJobEntitycopyJobInfo(AbstractJobEntity copyToJob, AbstractJobEntity copyFromJob) createAsyncJob(ExecutionEntity execution, boolean exclusive) Creates an async job for the providedExecutionEntity, so that it can be continued later in a background thread.protected DeadLetterJobEntityprotected JobEntityprotected SuspendedJobEntitycreateTimerJob(org.activiti.bpmn.model.TimerEventDefinition timerEventDefinition, boolean interrupting, ExecutionEntity execution, String timerEventType, String jobHandlerConfiguration) Creates aTimerJobEntitybased on the currentExecutionEntityand the configuration in theTimerEventDefinition.protected TimerJobEntitycreateTimerJobFromOtherJob(AbstractJobEntity otherJob) voidExecute a job, which means that the logic (async logic, timer that fires, etc) is executed, typically by a background thread of an executor.protected voidexecuteJobHandler(JobEntity jobEntity) protected voidexecuteMessageJob(JobEntity jobEntity) protected voidexecuteTimerJob(JobEntity timerEntity) protected voidfillDefaultAsyncJobInfo(JobEntity jobEntity, ExecutionEntity execution, boolean exclusive) protected AsyncExecutorprotected StringgetBusinessCalendarName(String calendarName, VariableScope variableScope) protected CommandContextprotected ExecutionEntityManagerprotected intgetMaxIterations(org.activiti.bpmn.model.Process process, String activityId) protected voidprotected JobEntityinternalCreateAsyncJob(ExecutionEntity execution, boolean exclusive) protected JobEntityinternalCreateLockedAsyncJob(ExecutionEntity execution, boolean exclusive) protected booleanprotected booleanisValidTime(JobEntity timerEntity, Date newTimerDate, VariableScope variableScope) moveDeadLetterJobToExecutableJob(DeadLetterJobEntity deadLetterJobEntity, int retries) Transforms aDeadLetterJobEntityto aJobEntity, thus making it executable again.Transforms anAbstractJobEntityto aDeadLetterJobEntity.Moves anAbstractJobEntityto become aSuspendedJobEntity, such that theAsyncExecutorwon't pick it up anymore for execution.Moves anAbstractJobEntityto become aTimerJobEntity.moveTimerJobToExecutableJob(TimerJobEntity timerJob) Moves aTimerJobEntityto become an asyncJobEntity.protected voidrestoreExtraData(JobEntity timerEntity, VariableScope variableScope) voidscheduleAsyncJob(JobEntity jobEntity) Schedules and async job.voidscheduleTimerJob(TimerJobEntity timerJob) Schedules a timer, meaning it will be inserted in the datastore.voidsetProcessEngineConfiguration(ProcessEngineConfigurationImpl processEngineConfiguration) The ProcessEngineCongiguration instance will be passed when theProcessEngineis built.protected voidtriggerExecutorIfNeeded(JobEntity jobEntity) voidUnacquires a job, meaning that this job was previously locked, and it is now freed to be acquired by other executor nodes.
-
Field Details
-
processEngineConfiguration
-
-
Constructor Details
-
DefaultJobManager
public DefaultJobManager() -
DefaultJobManager
-
-
Method Details
-
createAsyncJob
Description copied from interface:JobManagerCreates an async job for the providedExecutionEntity, so that it can be continued later in a background thread.- Specified by:
createAsyncJobin interfaceJobManager
-
scheduleAsyncJob
Description copied from interface:JobManagerSchedules and async job. If theAsyncExecutoris running, it can be executed immediately after the transaction. Otherwise it can be picked up by other executors.- Specified by:
scheduleAsyncJobin interfaceJobManager
-
triggerExecutorIfNeeded
-
createTimerJob
public TimerJobEntity createTimerJob(org.activiti.bpmn.model.TimerEventDefinition timerEventDefinition, boolean interrupting, ExecutionEntity execution, String timerEventType, String jobHandlerConfiguration) Description copied from interface:JobManagerCreates aTimerJobEntitybased on the currentExecutionEntityand the configuration in theTimerEventDefinition.- Specified by:
createTimerJobin interfaceJobManager
-
scheduleTimerJob
Description copied from interface:JobManagerSchedules a timer, meaning it will be inserted in the datastore.- Specified by:
scheduleTimerJobin interfaceJobManager
-
moveTimerJobToExecutableJob
Description copied from interface:JobManagerMoves aTimerJobEntityto become an asyncJobEntity. This happens for example when the due date of a timer is reached, the timer entity then becomes a 'regular' async job that can be picked up by theAsyncExecutor.- Specified by:
moveTimerJobToExecutableJobin interfaceJobManager
-
moveJobToTimerJob
Description copied from interface:JobManagerMoves anAbstractJobEntityto become aTimerJobEntity. This happens for example when an async job is executed and fails. It then becomes a timer, as it needs to be retried later.- Specified by:
moveJobToTimerJobin interfaceJobManager
-
moveJobToSuspendedJob
Description copied from interface:JobManagerMoves anAbstractJobEntityto become aSuspendedJobEntity, such that theAsyncExecutorwon't pick it up anymore for execution.- Specified by:
moveJobToSuspendedJobin interfaceJobManager
-
activateSuspendedJob
Description copied from interface:JobManagerTransforms aSuspendedJobEntityback to anAbstractJobEntity(i.e. to what it was originally). The job will now again be able to picked up by theAsyncExecutor.- Specified by:
activateSuspendedJobin interfaceJobManager
-
moveJobToDeadLetterJob
Description copied from interface:JobManagerTransforms anAbstractJobEntityto aDeadLetterJobEntity. This means that the job has been tried a configurable amount of times, but kept failing.- Specified by:
moveJobToDeadLetterJobin interfaceJobManager
-
moveDeadLetterJobToExecutableJob
public JobEntity moveDeadLetterJobToExecutableJob(DeadLetterJobEntity deadLetterJobEntity, int retries) Description copied from interface:JobManagerTransforms aDeadLetterJobEntityto aJobEntity, thus making it executable again. Note that a 'retries' parameter needs to be passed, as the job got into the deadletter table because of it failed and retries became 0.- Specified by:
moveDeadLetterJobToExecutableJobin interfaceJobManager
-
execute
Description copied from interface:JobManagerExecute a job, which means that the logic (async logic, timer that fires, etc) is executed, typically by a background thread of an executor.- Specified by:
executein interfaceJobManager
-
unacquire
Description copied from interface:JobManagerUnacquires a job, meaning that this job was previously locked, and it is now freed to be acquired by other executor nodes.- Specified by:
unacquirein interfaceJobManager
-
executeMessageJob
-
executeTimerJob
-
executeJobHandler
-
restoreExtraData
-
getMaxIterations
-
calculateMaxIterationsValue
-
isValidTime
protected boolean isValidTime(JobEntity timerEntity, Date newTimerDate, VariableScope variableScope) -
getBusinessCalendarName
-
hintAsyncExecutor
-
internalCreateAsyncJob
-
internalCreateLockedAsyncJob
-
fillDefaultAsyncJobInfo
protected void fillDefaultAsyncJobInfo(JobEntity jobEntity, ExecutionEntity execution, boolean exclusive) -
createExecutableJobFromOtherJob
-
createTimerJobFromOtherJob
-
createSuspendedJobFromOtherJob
-
createDeadLetterJobFromOtherJob
-
copyJobInfo
-
getProcessEngineConfiguration
-
setProcessEngineConfiguration
public void setProcessEngineConfiguration(ProcessEngineConfigurationImpl processEngineConfiguration) Description copied from interface:JobManagerThe ProcessEngineCongiguration instance will be passed when theProcessEngineis built.- Specified by:
setProcessEngineConfigurationin interfaceJobManager
-
isAsyncExecutorActive
protected boolean isAsyncExecutorActive() -
getCommandContext
-
getAsyncExecutor
-
getExecutionEntityManager
-