Class DefaultAsyncJobExecutor
- java.lang.Object
-
- org.flowable.job.service.impl.asyncexecutor.AbstractAsyncExecutor
-
- org.flowable.job.service.impl.asyncexecutor.DefaultAsyncJobExecutor
-
- All Implemented Interfaces:
AsyncExecutor
- Direct Known Subclasses:
DefaultAsyncHistoryJobExecutor,ManagedAsyncJobExecutor,SharedExecutorServiceAsyncExecutor
public class DefaultAsyncJobExecutor extends AbstractAsyncExecutor
- Author:
- Joram Barrez, Tijs Rademakers
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.flowable.job.service.impl.asyncexecutor.AbstractAsyncExecutor
AbstractAsyncExecutor.AcquireAsyncJobsDueRunnableConfiguration, AbstractAsyncExecutor.AcquireTimerRunnableConfiguration
-
-
Field Summary
Fields Modifier and Type Field Description protected ThreadasyncJobAcquisitionThreadThread responsible for async job acquisition.protected ThreadresetExpiredJobThreadThread responsible for resetting the expired jobs.protected booleanshutdownTaskExecutorprotected AsyncTaskExecutortaskExecutorThe async task executor used for job execution.protected ThreadtimerJobAcquisitionThreadThread responsible for timer job acquisition.-
Fields inherited from class org.flowable.job.service.impl.asyncexecutor.AbstractAsyncExecutor
asyncJobsDueLifecycleListener, asyncJobsDueRunnable, asyncRunnableExecutionExceptionHandler, configuration, executeAsyncRunnableFactory, isActive, isAutoActivate, isMessageQueueMode, jobEntityManager, jobServiceConfiguration, resetExpiredJobsRunnable, temporaryJobQueue, timerJobRunnable, timerLifecycleListener
-
-
Constructor Summary
Constructors Constructor Description DefaultAsyncJobExecutor()DefaultAsyncJobExecutor(AsyncJobExecutorConfiguration configuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ResetExpiredJobsRunnablecreateResetExpiredJobsRunnable(String resetRunnableName)protected booleanexecuteAsyncJob(JobInfo job, Runnable runnable)ThreadgetAsyncJobAcquisitionThread()ThreadgetResetExpiredJobThread()AsyncTaskExecutorgetTaskExecutor()The optional task executor for the async executorThreadgetTimerJobAcquisitionThread()protected voidinitAsyncJobExecutionThreadPool()booleanisAsyncJobAcquisitionEnabled()booleanisResetExpiredJobEnabled()booleanisTimerJobAcquisitionEnabled()booleanisUnlockOwnedJobs()protected voidsendRejectedEvent(JobInfo job)voidsetAsyncJobAcquisitionEnabled(boolean isAsyncJobAcquisitionEnabled)voidsetAsyncJobAcquisitionThread(Thread asyncJobAcquisitionThread)voidsetResetExpiredJobEnabled(boolean isResetExpiredJobEnabled)voidsetResetExpiredJobThread(Thread resetExpiredJobThread)voidsetTaskExecutor(AsyncTaskExecutor taskExecutor)Set the task executor for this async executor.voidsetTimerJobAcquisitionEnabled(boolean isTimerJobAcquisitionEnabled)voidsetTimerJobAcquisitionThread(Thread timerJobAcquisitionThread)voidsetUnlockOwnedJobs(boolean unlockOwnedJobs)protected voidshutdownAdditionalComponents()protected voidstartAdditionalComponents()protected voidstartJobAcquisitionThread()Starts the acquisition threadprotected voidstartResetExpiredJobsThread()Starts the reset expired jobs threadprotected voidstartTimerAcquisitionThread()protected voidstopExecutingAsyncJobs()protected voidstopJobAcquisitionThread()Stops the acquisition threadprotected voidstopResetExpiredJobsThread()Stops the reset expired jobs threadprotected voidstopTimerAcquisitionThread()protected voidunacquireJobAfterRejection(JobInfo job)-
Methods inherited from class org.flowable.job.service.impl.asyncexecutor.AbstractAsyncExecutor
createRunnableForJob, executeAsyncJob, executeTemporaryJobs, getAsyncJobLockTimeInMillis, getAsyncJobsDueLifecycleListener, getAsyncJobsDueRunnable, getAsyncJobsGlobalLockPollRate, getAsyncJobsGlobalLockWaitTime, getAsyncRunnableExecutionExceptionHandler, getConfiguration, getDefaultAsyncJobAcquireWaitTimeInMillis, getDefaultQueueSizeFullWaitTimeInMillis, getDefaultTimerJobAcquireWaitTimeInMillis, getExecuteAsyncRunnableFactory, getGlobalAcquireLockPrefix, getJobServiceConfiguration, getLockOwner, getMaxAsyncJobsDuePerAcquisition, getMaxTimerJobsPerAcquisition, getMoveTimerExecutorPoolSize, getResetExpiredJobsInterval, getResetExpiredJobsPageSize, getResetExpiredJobsRunnable, getRetryWaitTimeInMillis, getTenantId, getTimerJobRunnable, getTimerLifecycleListener, getTimerLockPollRate, getTimerLockTimeInMillis, getTimerLockWaitTime, initializeJobEntityManager, initializeRunnables, isActive, isAutoActivate, isGlobalAcquireLockEnabled, isMessageQueueMode, isTimerRunnableNeeded, setAcquireRunnableThreadName, setAsyncJobLockTimeInMillis, setAsyncJobsDueLifecycleListener, setAsyncJobsDueRunnable, setAsyncJobsGlobalLockPollRate, setAsyncJobsGlobalLockWaitTime, setAsyncRunnableExecutionExceptionHandler, setAutoActivate, setConfiguration, setDefaultAsyncJobAcquireWaitTimeInMillis, setDefaultQueueSizeFullWaitTimeInMillis, setDefaultTimerJobAcquireWaitTimeInMillis, setExecuteAsyncRunnableFactory, setGlobalAcquireLockEnabled, setGlobalAcquireLockPrefix, setJobEntityManager, setJobServiceConfiguration, setLockOwner, setMaxAsyncJobsDuePerAcquisition, setMaxTimerJobsPerAcquisition, setMessageQueueMode, setMoveTimerExecutorPoolSize, setResetExpiredJobsInterval, setResetExpiredJobsPageSize, setResetExpiredJobsRunnable, setResetExpiredRunnableName, setRetryWaitTimeInMillis, setTenantId, setTimerJobRunnable, setTimerLifecycleListener, setTimerLockPollRate, setTimerLockTimeInMillis, setTimerLockWaitTime, setTimerRunnableNeeded, shutdown, start, stopRunnables, unlockOwnedJobs
-
-
-
-
Field Detail
-
asyncJobAcquisitionThread
protected Thread asyncJobAcquisitionThread
Thread responsible for async job acquisition.
-
timerJobAcquisitionThread
protected Thread timerJobAcquisitionThread
Thread responsible for timer job acquisition.
-
resetExpiredJobThread
protected Thread resetExpiredJobThread
Thread responsible for resetting the expired jobs.
-
taskExecutor
protected AsyncTaskExecutor taskExecutor
The async task executor used for job execution.
-
shutdownTaskExecutor
protected boolean shutdownTaskExecutor
-
-
Constructor Detail
-
DefaultAsyncJobExecutor
public DefaultAsyncJobExecutor()
-
DefaultAsyncJobExecutor
public DefaultAsyncJobExecutor(AsyncJobExecutorConfiguration configuration)
-
-
Method Detail
-
executeAsyncJob
protected boolean executeAsyncJob(JobInfo job, Runnable runnable)
- Specified by:
executeAsyncJobin classAbstractAsyncExecutor
-
sendRejectedEvent
protected void sendRejectedEvent(JobInfo job)
-
unacquireJobAfterRejection
protected void unacquireJobAfterRejection(JobInfo job)
-
startAdditionalComponents
protected void startAdditionalComponents()
- Specified by:
startAdditionalComponentsin classAbstractAsyncExecutor
-
shutdownAdditionalComponents
protected void shutdownAdditionalComponents()
- Specified by:
shutdownAdditionalComponentsin classAbstractAsyncExecutor
-
createResetExpiredJobsRunnable
protected ResetExpiredJobsRunnable createResetExpiredJobsRunnable(String resetRunnableName)
- Specified by:
createResetExpiredJobsRunnablein classAbstractAsyncExecutor
-
initAsyncJobExecutionThreadPool
protected void initAsyncJobExecutionThreadPool()
-
stopExecutingAsyncJobs
protected void stopExecutingAsyncJobs()
-
startJobAcquisitionThread
protected void startJobAcquisitionThread()
Starts the acquisition thread
-
startTimerAcquisitionThread
protected void startTimerAcquisitionThread()
-
stopJobAcquisitionThread
protected void stopJobAcquisitionThread()
Stops the acquisition thread
-
stopTimerAcquisitionThread
protected void stopTimerAcquisitionThread()
-
startResetExpiredJobsThread
protected void startResetExpiredJobsThread()
Starts the reset expired jobs thread
-
stopResetExpiredJobsThread
protected void stopResetExpiredJobsThread()
Stops the reset expired jobs thread
-
isAsyncJobAcquisitionEnabled
public boolean isAsyncJobAcquisitionEnabled()
-
setAsyncJobAcquisitionEnabled
public void setAsyncJobAcquisitionEnabled(boolean isAsyncJobAcquisitionEnabled)
-
isTimerJobAcquisitionEnabled
public boolean isTimerJobAcquisitionEnabled()
-
setTimerJobAcquisitionEnabled
public void setTimerJobAcquisitionEnabled(boolean isTimerJobAcquisitionEnabled)
-
isResetExpiredJobEnabled
public boolean isResetExpiredJobEnabled()
-
setResetExpiredJobEnabled
public void setResetExpiredJobEnabled(boolean isResetExpiredJobEnabled)
-
getTimerJobAcquisitionThread
public Thread getTimerJobAcquisitionThread()
-
setTimerJobAcquisitionThread
public void setTimerJobAcquisitionThread(Thread timerJobAcquisitionThread)
-
getAsyncJobAcquisitionThread
public Thread getAsyncJobAcquisitionThread()
-
setAsyncJobAcquisitionThread
public void setAsyncJobAcquisitionThread(Thread asyncJobAcquisitionThread)
-
getResetExpiredJobThread
public Thread getResetExpiredJobThread()
-
setResetExpiredJobThread
public void setResetExpiredJobThread(Thread resetExpiredJobThread)
-
isUnlockOwnedJobs
public boolean isUnlockOwnedJobs()
-
setUnlockOwnedJobs
public void setUnlockOwnedJobs(boolean unlockOwnedJobs)
-
getTaskExecutor
public AsyncTaskExecutor getTaskExecutor()
Description copied from interface:AsyncExecutorThe optional task executor for the async executor- Returns:
- the task executor used by this async executor
-
setTaskExecutor
public void setTaskExecutor(AsyncTaskExecutor taskExecutor)
Description copied from interface:AsyncExecutorSet the task executor for this async executor.
-
-