public class DefaultJobManager extends Object implements JobManager
| Modifier and Type | Field and Description |
|---|---|
static String |
ASYNC_JOB_TYPE |
static String |
CYCLE_TYPE |
protected JobServiceConfiguration |
jobServiceConfiguration |
| Constructor and Description |
|---|
DefaultJobManager() |
DefaultJobManager(JobServiceConfiguration jobServiceConfiguration) |
| Modifier and Type | Method and Description |
|---|---|
AbstractRuntimeJobEntity |
activateSuspendedJob(SuspendedJobEntity job)
Transforms a
SuspendedJobEntity back to an AbstractRuntimeJobEntity (i.e. |
protected HistoryJobEntity |
copyHistoryJobInfo(HistoryJobEntity copyToJob,
HistoryJobEntity copyFromJob) |
protected AbstractRuntimeJobEntity |
copyJobInfo(AbstractRuntimeJobEntity copyToJob,
AbstractRuntimeJobEntity copyFromJob) |
void |
createAsyncJob(JobEntity jobEntity,
boolean exclusive)
Creates an async job so that it can be continued later in a background thread.
|
protected DeadLetterJobEntity |
createDeadLetterJobFromOtherJob(AbstractRuntimeJobEntity otherJob) |
protected JobEntity |
createExecutableJobFromOtherJob(AbstractRuntimeJobEntity job) |
protected SuspendedJobEntity |
createSuspendedJobFromOtherJob(AbstractRuntimeJobEntity otherJob) |
protected TimerJobEntity |
createTimerJobFromOtherJob(AbstractRuntimeJobEntity otherJob) |
void |
execute(JobInfo 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 |
executeHistoryJob(HistoryJobEntity historyJobEntity) |
protected void |
executeHistoryJobHandler(HistoryJobEntity historyJobEntity) |
protected void |
executeJobHandler(JobEntity jobEntity) |
protected void |
executeMessageJob(JobEntity jobEntity) |
protected void |
executeTimerJob(JobEntity timerEntity) |
protected void |
fillDefaultAsyncJobInfo(JobEntity jobEntity,
boolean exclusive) |
protected AsyncExecutor |
getAsyncExecutor() |
String |
getBusinessCalendarName(JobEntity timerEntity,
org.flowable.variable.api.delegate.VariableScope variableScope)
Get the business calendar name of the job configuration
|
protected String |
getBusinessCalendarName(String calendarName,
org.flowable.variable.api.delegate.VariableScope variableScope) |
protected CommandContext |
getCommandContext() |
JobServiceConfiguration |
getJobServiceConfiguration() |
protected void |
hintAsyncExecutor(JobEntity job) |
protected void |
internalCreateAsyncJob(JobEntity jobEntity,
boolean exclusive) |
protected void |
internalCreateLockedAsyncJob(JobEntity jobEntity,
boolean exclusive) |
protected boolean |
isAsyncExecutorActive() |
protected boolean |
isValidTime(JobEntity timerEntity,
Date newTimerDate,
org.flowable.variable.api.delegate.VariableScope variableScope) |
JobEntity |
moveDeadLetterJobToExecutableJob(DeadLetterJobEntity deadLetterJobEntity,
int retries)
Transforms a
DeadLetterJobEntity to a JobEntity, thus making it executable again. |
DeadLetterJobEntity |
moveJobToDeadLetterJob(AbstractRuntimeJobEntity job)
Transforms an
AbstractRuntimeJobEntity to a DeadLetterJobEntity. |
SuspendedJobEntity |
moveJobToSuspendedJob(AbstractRuntimeJobEntity job)
Moves an
AbstractRuntimeJobEntity to become a SuspendedJobEntity, such that the AsyncExecutor won't pick it up anymore for execution. |
TimerJobEntity |
moveJobToTimerJob(AbstractRuntimeJobEntity job)
Moves an
AbstractRuntimeJobEntity to become a TimerJobEntity. |
JobEntity |
moveTimerJobToExecutableJob(TimerJobEntity timerJob)
Moves a
TimerJobEntity to become an async JobEntity. |
void |
scheduleAsyncJob(JobEntity jobEntity)
Schedules and async job.
|
HistoryJobEntity |
scheduleHistoryJob(HistoryJobEntity historyJobEntity)
schedules a
HistoryJobEntity, meaning it will be scheduled (inserted in the database/put on a queue/...) to be executed at a later point in time. |
void |
scheduleTimerJob(TimerJobEntity timerJob)
Schedules a timer, meaning it will be inserted in the datastore.
|
void |
setJobServiceConfiguration(JobServiceConfiguration jobServiceConfiguration)
The ProcessEngineConfiguration instance will be passed when the ProcessEngine is built.
|
protected void |
triggerExecutorIfNeeded(JobEntity jobEntity) |
void |
unacquire(JobInfo job)
Unacquires a job, meaning that this job was previously locked, and it is now freed to be acquired by other executor nodes.
|
void |
unacquireWithDecrementRetries(JobInfo job)
Unacquires a job, meaning that this job was previously locked, and it is now freed to be acquired by other executor nodes.
|
public static final String ASYNC_JOB_TYPE
public static final String CYCLE_TYPE
protected JobServiceConfiguration jobServiceConfiguration
public DefaultJobManager()
public DefaultJobManager(JobServiceConfiguration jobServiceConfiguration)
public void createAsyncJob(JobEntity jobEntity, boolean exclusive)
JobManagercreateAsyncJob 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 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(AbstractRuntimeJobEntity job)
JobManagerAbstractRuntimeJobEntity 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(AbstractRuntimeJobEntity job)
JobManagerAbstractRuntimeJobEntity to become a SuspendedJobEntity, such that the AsyncExecutor won't pick it up anymore for execution.moveJobToSuspendedJob in interface JobManagerpublic AbstractRuntimeJobEntity activateSuspendedJob(SuspendedJobEntity job)
JobManagerSuspendedJobEntity back to an AbstractRuntimeJobEntity (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(AbstractRuntimeJobEntity job)
JobManagerAbstractRuntimeJobEntity 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(JobInfo job)
JobManagerexecute in interface JobManagerpublic void unacquire(JobInfo job)
JobManagerunacquire in interface JobManagerpublic void unacquireWithDecrementRetries(JobInfo job)
JobManagerunacquireWithDecrementRetries in interface JobManagerprotected void executeMessageJob(JobEntity jobEntity)
protected void executeHistoryJob(HistoryJobEntity historyJobEntity)
protected void executeTimerJob(JobEntity timerEntity)
protected void executeJobHandler(JobEntity jobEntity)
protected void executeHistoryJobHandler(HistoryJobEntity historyJobEntity)
protected boolean isValidTime(JobEntity timerEntity, Date newTimerDate, org.flowable.variable.api.delegate.VariableScope variableScope)
protected void hintAsyncExecutor(JobEntity job)
public String getBusinessCalendarName(JobEntity timerEntity, org.flowable.variable.api.delegate.VariableScope variableScope)
JobManagergetBusinessCalendarName in interface JobManagerprotected String getBusinessCalendarName(String calendarName, org.flowable.variable.api.delegate.VariableScope variableScope)
public HistoryJobEntity scheduleHistoryJob(HistoryJobEntity historyJobEntity)
JobManagerHistoryJobEntity, meaning it will be scheduled (inserted in the database/put on a queue/...) to be executed at a later point in time.scheduleHistoryJob in interface JobManagerprotected void internalCreateAsyncJob(JobEntity jobEntity, boolean exclusive)
protected void internalCreateLockedAsyncJob(JobEntity jobEntity, boolean exclusive)
protected void fillDefaultAsyncJobInfo(JobEntity jobEntity, boolean exclusive)
protected JobEntity createExecutableJobFromOtherJob(AbstractRuntimeJobEntity job)
protected TimerJobEntity createTimerJobFromOtherJob(AbstractRuntimeJobEntity otherJob)
protected SuspendedJobEntity createSuspendedJobFromOtherJob(AbstractRuntimeJobEntity otherJob)
protected DeadLetterJobEntity createDeadLetterJobFromOtherJob(AbstractRuntimeJobEntity otherJob)
protected AbstractRuntimeJobEntity copyJobInfo(AbstractRuntimeJobEntity copyToJob, AbstractRuntimeJobEntity copyFromJob)
protected HistoryJobEntity copyHistoryJobInfo(HistoryJobEntity copyToJob, HistoryJobEntity copyFromJob)
public JobServiceConfiguration getJobServiceConfiguration()
public void setJobServiceConfiguration(JobServiceConfiguration jobServiceConfiguration)
JobManagersetJobServiceConfiguration in interface JobManagerprotected boolean isAsyncExecutorActive()
protected CommandContext getCommandContext()
protected AsyncExecutor getAsyncExecutor()
Copyright © 2017 Flowable. All rights reserved.