public class DefaultJobManager extends Object implements JobManager
| Modifier and Type | Field and Description |
|---|---|
protected ProcessEngineConfigurationImpl |
processEngineConfiguration |
| Constructor and Description |
|---|
DefaultJobManager() |
DefaultJobManager(ProcessEngineConfigurationImpl processEngineConfiguration) |
| Modifier and Type | Method and Description |
|---|---|
AbstractJobEntity |
activateSuspendedJob(SuspendedJobEntity job)
Transforms a
SuspendedJobEntity back to an AbstractJobEntity
(i.e. |
protected int |
calculateMaxIterationsValue(String originalExpression) |
protected AbstractJobEntity |
copyJobInfo(AbstractJobEntity copyToJob,
AbstractJobEntity copyFromJob) |
JobEntity |
createAsyncJob(ExecutionEntity execution,
boolean exclusive)
Creates an async job for the provided
ExecutionEntity, so that
it can be continued later in a background thread. |
protected DeadLetterJobEntity |
createDeadLetterJobFromOtherJob(AbstractJobEntity otherJob) |
protected JobEntity |
createExecutableJobFromOtherJob(AbstractJobEntity job) |
protected SuspendedJobEntity |
createSuspendedJobFromOtherJob(AbstractJobEntity otherJob) |
TimerJobEntity |
createTimerJob(TimerEventDefinition timerEventDefinition,
boolean interrupting,
ExecutionEntity execution,
String timerEventType,
String jobHandlerConfiguration)
Creates a
TimerJobEntity based on the current ExecutionEntity and the
configuration in the TimerEventDefinition. |
protected TimerJobEntity |
createTimerJobFromOtherJob(AbstractJobEntity otherJob) |
void |
execute(Job job)
Execute a job, which means that the logic (async logic, timer that fires, etc)
is executed, typically by a background thread of an executor.
|
protected void |
executeJobHandler(JobEntity jobEntity) |
protected void |
executeMessageJob(JobEntity jobEntity) |
protected void |
executeTimerJob(JobEntity timerEntity) |
protected void |
fillDefaultAsyncJobInfo(JobEntity jobEntity,
ExecutionEntity execution,
boolean exclusive) |
protected AsyncExecutor |
getAsyncExecutor() |
protected String |
getBusinessCalendarName(String calendarName,
VariableScope variableScope) |
protected CommandContext |
getCommandContext() |
protected ExecutionEntityManager |
getExecutionEntityManager() |
protected int |
getMaxIterations(Process process,
String activityId) |
ProcessEngineConfigurationImpl |
getProcessEngineConfiguration() |
protected void |
hintAsyncExecutor(JobEntity job) |
protected JobEntity |
internalCreateAsyncJob(ExecutionEntity execution,
boolean exclusive) |
protected JobEntity |
internalCreateLockedAsyncJob(ExecutionEntity execution,
boolean exclusive) |
protected boolean |
isAsyncExecutorActive() |
protected boolean |
isValidTime(JobEntity timerEntity,
Date newTimerDate,
VariableScope variableScope) |
JobEntity |
moveDeadLetterJobToExecutableJob(DeadLetterJobEntity deadLetterJobEntity,
int retries)
Transforms a
DeadLetterJobEntity to a JobEntity, thus
making it executable again. |
DeadLetterJobEntity |
moveJobToDeadLetterJob(AbstractJobEntity job)
Transforms an
AbstractJobEntity to a DeadLetterJobEntity. |
SuspendedJobEntity |
moveJobToSuspendedJob(AbstractJobEntity job)
Moves an
AbstractJobEntity to become a SuspendedJobEntity,
such that the AsyncExecutor won't pick it up anymore for execution. |
TimerJobEntity |
moveJobToTimerJob(AbstractJobEntity job)
Moves an
AbstractJobEntity to become a TimerJobEntity. |
JobEntity |
moveTimerJobToExecutableJob(TimerJobEntity timerJob)
Moves a
TimerJobEntity to become an async JobEntity. |
protected void |
restoreExtraData(JobEntity timerEntity,
VariableScope variableScope) |
void |
scheduleAsyncJob(JobEntity jobEntity)
Schedules and async job.
|
void |
scheduleTimerJob(TimerJobEntity timerJob)
Schedules a timer, meaning it will be inserted in the datastore.
|
void |
setProcessEngineConfiguration(ProcessEngineConfigurationImpl processEngineConfiguration)
The ProcessEngineCongiguration instance will be passed when the
ProcessEngine is built. |
protected void |
triggerExecutorIfNeeded(JobEntity jobEntity) |
void |
unacquire(Job job)
Unacquires a job, meaning that this job was previously locked, and
it is now freed to be acquired by other executor nodes.
|
protected ProcessEngineConfigurationImpl processEngineConfiguration
public DefaultJobManager()
public DefaultJobManager(ProcessEngineConfigurationImpl processEngineConfiguration)
public JobEntity createAsyncJob(ExecutionEntity execution, boolean exclusive)
JobManagerExecutionEntity, so that
it can be continued later in a background thread.createAsyncJob in interface JobManagerpublic void scheduleAsyncJob(JobEntity jobEntity)
JobManagerAsyncExecutor is running, it
can be executed immediately after the transaction. Otherwise it can
be picked up by other executors.scheduleAsyncJob in interface JobManagerprotected void triggerExecutorIfNeeded(JobEntity jobEntity)
public TimerJobEntity createTimerJob(TimerEventDefinition timerEventDefinition, boolean interrupting, ExecutionEntity execution, String timerEventType, String jobHandlerConfiguration)
JobManagerTimerJobEntity based on the current ExecutionEntity and the
configuration in the TimerEventDefinition.createTimerJob in interface JobManagerpublic void scheduleTimerJob(TimerJobEntity timerJob)
JobManagerscheduleTimerJob in interface JobManagerpublic JobEntity moveTimerJobToExecutableJob(TimerJobEntity timerJob)
JobManagerTimerJobEntity to become an async JobEntity.
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 the AsyncExecutor.moveTimerJobToExecutableJob in interface JobManagerpublic TimerJobEntity moveJobToTimerJob(AbstractJobEntity job)
JobManagerAbstractJobEntity to become a TimerJobEntity.
This happens for example when an async job is executed and fails.
It then becomes a timer, as it needs to be retried later.moveJobToTimerJob in interface JobManagerpublic SuspendedJobEntity moveJobToSuspendedJob(AbstractJobEntity job)
JobManagerAbstractJobEntity to become a SuspendedJobEntity,
such that the AsyncExecutor won't pick it up anymore for execution.moveJobToSuspendedJob in interface JobManagerpublic AbstractJobEntity activateSuspendedJob(SuspendedJobEntity job)
JobManagerSuspendedJobEntity back to an AbstractJobEntity
(i.e. to what it was originally). The job will now again be able to
picked up by the AsyncExecutor.activateSuspendedJob in interface JobManagerpublic DeadLetterJobEntity moveJobToDeadLetterJob(AbstractJobEntity job)
JobManagerAbstractJobEntity to a DeadLetterJobEntity.
This means that the job has been tried a configurable amount of times,
but kept failing.moveJobToDeadLetterJob in interface JobManagerpublic JobEntity moveDeadLetterJobToExecutableJob(DeadLetterJobEntity deadLetterJobEntity, int retries)
JobManagerDeadLetterJobEntity to a JobEntity, 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.moveDeadLetterJobToExecutableJob in interface JobManagerpublic void execute(Job job)
JobManagerexecute in interface JobManagerpublic void unacquire(Job job)
JobManagerunacquire in interface JobManagerprotected void executeMessageJob(JobEntity jobEntity)
protected void executeTimerJob(JobEntity timerEntity)
protected void executeJobHandler(JobEntity jobEntity)
protected void restoreExtraData(JobEntity timerEntity, VariableScope variableScope)
protected int calculateMaxIterationsValue(String originalExpression)
protected boolean isValidTime(JobEntity timerEntity, Date newTimerDate, VariableScope variableScope)
protected String getBusinessCalendarName(String calendarName, VariableScope variableScope)
protected void hintAsyncExecutor(JobEntity job)
protected JobEntity internalCreateAsyncJob(ExecutionEntity execution, boolean exclusive)
protected JobEntity internalCreateLockedAsyncJob(ExecutionEntity execution, boolean exclusive)
protected void fillDefaultAsyncJobInfo(JobEntity jobEntity, ExecutionEntity execution, boolean exclusive)
protected JobEntity createExecutableJobFromOtherJob(AbstractJobEntity job)
protected TimerJobEntity createTimerJobFromOtherJob(AbstractJobEntity otherJob)
protected SuspendedJobEntity createSuspendedJobFromOtherJob(AbstractJobEntity otherJob)
protected DeadLetterJobEntity createDeadLetterJobFromOtherJob(AbstractJobEntity otherJob)
protected AbstractJobEntity copyJobInfo(AbstractJobEntity copyToJob, AbstractJobEntity copyFromJob)
public ProcessEngineConfigurationImpl getProcessEngineConfiguration()
public void setProcessEngineConfiguration(ProcessEngineConfigurationImpl processEngineConfiguration)
JobManagerProcessEngine is built.setProcessEngineConfiguration in interface JobManagerprotected boolean isAsyncExecutorActive()
protected CommandContext getCommandContext()
protected AsyncExecutor getAsyncExecutor()
protected ExecutionEntityManager getExecutionEntityManager()
Copyright © 2010–2018 Alfresco. All rights reserved.