Class AbstractAsyncExecutor
- java.lang.Object
-
- org.flowable.job.service.impl.asyncexecutor.AbstractAsyncExecutor
-
- All Implemented Interfaces:
AsyncExecutor
- Direct Known Subclasses:
DefaultAsyncJobExecutor
public abstract class AbstractAsyncExecutor extends Object implements AsyncExecutor
- Author:
- Joram Barrez, Tijs Rademakers, Marcus Klimstra
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classAbstractAsyncExecutor.AcquireAsyncJobsDueRunnableConfigurationclassAbstractAsyncExecutor.AcquireTimerRunnableConfiguration
-
Field Summary
Fields Modifier and Type Field Description protected AcquireAsyncJobsDueLifecycleListenerasyncJobsDueLifecycleListenerprotected AcquireAsyncJobsDueRunnableasyncJobsDueRunnableprotected AsyncRunnableExecutionExceptionHandlerasyncRunnableExecutionExceptionHandlerprotected AsyncJobExecutorConfigurationconfigurationprotected ExecuteAsyncRunnableFactoryexecuteAsyncRunnableFactoryprotected booleanisActiveprotected booleanisAutoActivateprotected booleanisMessageQueueModeprotected JobInfoEntityManager<? extends JobInfoEntity>jobEntityManagerprotected JobServiceConfigurationjobServiceConfigurationprotected ResetExpiredJobsRunnableresetExpiredJobsRunnableprotected LinkedList<JobInfo>temporaryJobQueueprotected AcquireTimerJobsRunnabletimerJobRunnableprotected AcquireTimerLifecycleListenertimerLifecycleListener
-
Constructor Summary
Constructors Constructor Description AbstractAsyncExecutor()AbstractAsyncExecutor(AsyncJobExecutorConfiguration configuration)
-
Method Summary
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.flowable.job.service.impl.asyncexecutor.AsyncExecutor
getTaskExecutor, setTaskExecutor
-
-
-
-
Field Detail
-
configuration
protected AsyncJobExecutorConfiguration configuration
-
timerJobRunnable
protected AcquireTimerJobsRunnable timerJobRunnable
-
timerLifecycleListener
protected AcquireTimerLifecycleListener timerLifecycleListener
-
jobEntityManager
protected JobInfoEntityManager<? extends JobInfoEntity> jobEntityManager
-
asyncJobsDueRunnable
protected AcquireAsyncJobsDueRunnable asyncJobsDueRunnable
-
asyncJobsDueLifecycleListener
protected AcquireAsyncJobsDueLifecycleListener asyncJobsDueLifecycleListener
-
resetExpiredJobsRunnable
protected ResetExpiredJobsRunnable resetExpiredJobsRunnable
-
executeAsyncRunnableFactory
protected ExecuteAsyncRunnableFactory executeAsyncRunnableFactory
-
asyncRunnableExecutionExceptionHandler
protected AsyncRunnableExecutionExceptionHandler asyncRunnableExecutionExceptionHandler
-
isAutoActivate
protected boolean isAutoActivate
-
isActive
protected boolean isActive
-
isMessageQueueMode
protected boolean isMessageQueueMode
-
temporaryJobQueue
protected LinkedList<JobInfo> temporaryJobQueue
-
jobServiceConfiguration
protected JobServiceConfiguration jobServiceConfiguration
-
-
Constructor Detail
-
AbstractAsyncExecutor
public AbstractAsyncExecutor()
-
AbstractAsyncExecutor
public AbstractAsyncExecutor(AsyncJobExecutorConfiguration configuration)
-
-
Method Detail
-
executeAsyncJob
public boolean executeAsyncJob(JobInfo job)
Description copied from interface:AsyncExecutorOffers the providedJobInfoto thisAsyncExecutorinstance to execute. If the offering does not work for some reason, false will be returned (For example when the job queue is full in theDefaultAsyncJobExecutor).- Specified by:
executeAsyncJobin interfaceAsyncExecutor
-
unlockOwnedJobs
protected void unlockOwnedJobs()
-
start
public void start()
Starts the async executor- Specified by:
startin interfaceAsyncExecutor
-
initializeJobEntityManager
protected void initializeJobEntityManager()
-
initializeRunnables
protected void initializeRunnables()
-
createResetExpiredJobsRunnable
protected abstract ResetExpiredJobsRunnable createResetExpiredJobsRunnable(String resetRunnableName)
-
startAdditionalComponents
protected abstract void startAdditionalComponents()
-
executeTemporaryJobs
protected void executeTemporaryJobs()
-
shutdown
public void shutdown()
Shuts down the whole job executor- Specified by:
shutdownin interfaceAsyncExecutor
-
stopRunnables
protected void stopRunnables()
-
shutdownAdditionalComponents
protected abstract void shutdownAdditionalComponents()
-
getJobServiceConfiguration
public JobServiceConfiguration getJobServiceConfiguration()
- Specified by:
getJobServiceConfigurationin interfaceAsyncExecutor
-
setJobServiceConfiguration
public void setJobServiceConfiguration(JobServiceConfiguration jobServiceConfiguration)
- Specified by:
setJobServiceConfigurationin interfaceAsyncExecutor
-
isAutoActivate
public boolean isAutoActivate()
- Specified by:
isAutoActivatein interfaceAsyncExecutor
-
setAutoActivate
public void setAutoActivate(boolean isAutoActivate)
- Specified by:
setAutoActivatein interfaceAsyncExecutor
-
isActive
public boolean isActive()
- Specified by:
isActivein interfaceAsyncExecutor
-
isMessageQueueMode
public boolean isMessageQueueMode()
-
setMessageQueueMode
public void setMessageQueueMode(boolean isMessageQueueMode)
-
getLockOwner
public String getLockOwner()
- Specified by:
getLockOwnerin interfaceAsyncExecutor
-
setLockOwner
public void setLockOwner(String lockOwner)
-
getTimerLockTimeInMillis
public int getTimerLockTimeInMillis()
- Specified by:
getTimerLockTimeInMillisin interfaceAsyncExecutor
-
setTimerLockTimeInMillis
public void setTimerLockTimeInMillis(int timerLockTimeInMillis)
- Specified by:
setTimerLockTimeInMillisin interfaceAsyncExecutor
-
getAsyncJobLockTimeInMillis
public int getAsyncJobLockTimeInMillis()
- Specified by:
getAsyncJobLockTimeInMillisin interfaceAsyncExecutor
-
setAsyncJobLockTimeInMillis
public void setAsyncJobLockTimeInMillis(int asyncJobLockTimeInMillis)
- Specified by:
setAsyncJobLockTimeInMillisin interfaceAsyncExecutor
-
getMoveTimerExecutorPoolSize
public int getMoveTimerExecutorPoolSize()
-
setMoveTimerExecutorPoolSize
public void setMoveTimerExecutorPoolSize(int moveTimerExecutorPoolSize)
-
getMaxTimerJobsPerAcquisition
public int getMaxTimerJobsPerAcquisition()
- Specified by:
getMaxTimerJobsPerAcquisitionin interfaceAsyncExecutor
-
setMaxTimerJobsPerAcquisition
public void setMaxTimerJobsPerAcquisition(int maxTimerJobsPerAcquisition)
- Specified by:
setMaxTimerJobsPerAcquisitionin interfaceAsyncExecutor
-
getMaxAsyncJobsDuePerAcquisition
public int getMaxAsyncJobsDuePerAcquisition()
- Specified by:
getMaxAsyncJobsDuePerAcquisitionin interfaceAsyncExecutor
-
setMaxAsyncJobsDuePerAcquisition
public void setMaxAsyncJobsDuePerAcquisition(int maxAsyncJobsDuePerAcquisition)
- Specified by:
setMaxAsyncJobsDuePerAcquisitionin interfaceAsyncExecutor
-
getDefaultTimerJobAcquireWaitTimeInMillis
public int getDefaultTimerJobAcquireWaitTimeInMillis()
- Specified by:
getDefaultTimerJobAcquireWaitTimeInMillisin interfaceAsyncExecutor
-
setDefaultTimerJobAcquireWaitTimeInMillis
public void setDefaultTimerJobAcquireWaitTimeInMillis(int defaultTimerJobAcquireWaitTimeInMillis)
- Specified by:
setDefaultTimerJobAcquireWaitTimeInMillisin interfaceAsyncExecutor
-
getDefaultAsyncJobAcquireWaitTimeInMillis
public int getDefaultAsyncJobAcquireWaitTimeInMillis()
- Specified by:
getDefaultAsyncJobAcquireWaitTimeInMillisin interfaceAsyncExecutor
-
setDefaultAsyncJobAcquireWaitTimeInMillis
public void setDefaultAsyncJobAcquireWaitTimeInMillis(int defaultAsyncJobAcquireWaitTimeInMillis)
- Specified by:
setDefaultAsyncJobAcquireWaitTimeInMillisin interfaceAsyncExecutor
-
setTimerJobRunnable
public void setTimerJobRunnable(AcquireTimerJobsRunnable timerJobRunnable)
-
getDefaultQueueSizeFullWaitTimeInMillis
public int getDefaultQueueSizeFullWaitTimeInMillis()
- Specified by:
getDefaultQueueSizeFullWaitTimeInMillisin interfaceAsyncExecutor
-
setDefaultQueueSizeFullWaitTimeInMillis
public void setDefaultQueueSizeFullWaitTimeInMillis(int defaultQueueSizeFullWaitTime)
- Specified by:
setDefaultQueueSizeFullWaitTimeInMillisin interfaceAsyncExecutor
-
setAsyncJobsDueRunnable
public void setAsyncJobsDueRunnable(AcquireAsyncJobsDueRunnable asyncJobsDueRunnable)
-
getAsyncJobsDueLifecycleListener
public AcquireAsyncJobsDueLifecycleListener getAsyncJobsDueLifecycleListener()
-
setAsyncJobsDueLifecycleListener
public void setAsyncJobsDueLifecycleListener(AcquireAsyncJobsDueLifecycleListener asyncJobsDueLifecycleListener)
-
isTimerRunnableNeeded
public boolean isTimerRunnableNeeded()
-
setTimerRunnableNeeded
public void setTimerRunnableNeeded(boolean timerRunnableNeeded)
-
getTimerLifecycleListener
public AcquireTimerLifecycleListener getTimerLifecycleListener()
-
setTimerLifecycleListener
public void setTimerLifecycleListener(AcquireTimerLifecycleListener timerLifecycleListener)
-
isGlobalAcquireLockEnabled
public boolean isGlobalAcquireLockEnabled()
-
setGlobalAcquireLockEnabled
public void setGlobalAcquireLockEnabled(boolean globalAcquireLockEnabled)
-
getGlobalAcquireLockPrefix
public String getGlobalAcquireLockPrefix()
-
setGlobalAcquireLockPrefix
public void setGlobalAcquireLockPrefix(String globalAcquireLockPrefix)
-
getAsyncJobsGlobalLockWaitTime
public Duration getAsyncJobsGlobalLockWaitTime()
-
setAsyncJobsGlobalLockWaitTime
public void setAsyncJobsGlobalLockWaitTime(Duration asyncJobsGlobalLockWaitTime)
-
getAsyncJobsGlobalLockPollRate
public Duration getAsyncJobsGlobalLockPollRate()
-
setAsyncJobsGlobalLockPollRate
public void setAsyncJobsGlobalLockPollRate(Duration asyncJobsGlobalLockPollRate)
-
getTimerLockWaitTime
public Duration getTimerLockWaitTime()
-
setTimerLockWaitTime
public void setTimerLockWaitTime(Duration timerLockWaitTime)
-
getTimerLockPollRate
public Duration getTimerLockPollRate()
-
setTimerLockPollRate
public void setTimerLockPollRate(Duration timerLockPollRate)
-
setAcquireRunnableThreadName
public void setAcquireRunnableThreadName(String acquireRunnableThreadName)
-
setJobEntityManager
public void setJobEntityManager(JobInfoEntityManager<? extends JobInfoEntity> jobEntityManager)
-
setResetExpiredRunnableName
public void setResetExpiredRunnableName(String resetExpiredRunnableName)
-
setResetExpiredJobsRunnable
public void setResetExpiredJobsRunnable(ResetExpiredJobsRunnable resetExpiredJobsRunnable)
-
getRetryWaitTimeInMillis
@Deprecated public int getRetryWaitTimeInMillis()
Deprecated.- Specified by:
getRetryWaitTimeInMillisin interfaceAsyncExecutor
-
setRetryWaitTimeInMillis
@Deprecated public void setRetryWaitTimeInMillis(int retryWaitTimeInMillis)
Deprecated.- Specified by:
setRetryWaitTimeInMillisin interfaceAsyncExecutor
-
getResetExpiredJobsInterval
public int getResetExpiredJobsInterval()
- Specified by:
getResetExpiredJobsIntervalin interfaceAsyncExecutor
-
setResetExpiredJobsInterval
public void setResetExpiredJobsInterval(int resetExpiredJobsInterval)
- Specified by:
setResetExpiredJobsIntervalin interfaceAsyncExecutor
-
getResetExpiredJobsPageSize
public int getResetExpiredJobsPageSize()
- Specified by:
getResetExpiredJobsPageSizein interfaceAsyncExecutor
-
setResetExpiredJobsPageSize
public void setResetExpiredJobsPageSize(int resetExpiredJobsPageSize)
- Specified by:
setResetExpiredJobsPageSizein interfaceAsyncExecutor
-
getExecuteAsyncRunnableFactory
public ExecuteAsyncRunnableFactory getExecuteAsyncRunnableFactory()
-
setExecuteAsyncRunnableFactory
public void setExecuteAsyncRunnableFactory(ExecuteAsyncRunnableFactory executeAsyncRunnableFactory)
-
getAsyncRunnableExecutionExceptionHandler
public AsyncRunnableExecutionExceptionHandler getAsyncRunnableExecutionExceptionHandler()
-
setAsyncRunnableExecutionExceptionHandler
public void setAsyncRunnableExecutionExceptionHandler(AsyncRunnableExecutionExceptionHandler asyncRunnableExecutionExceptionHandler)
-
getTimerJobRunnable
public AcquireTimerJobsRunnable getTimerJobRunnable()
-
getAsyncJobsDueRunnable
public AcquireAsyncJobsDueRunnable getAsyncJobsDueRunnable()
-
getResetExpiredJobsRunnable
public ResetExpiredJobsRunnable getResetExpiredJobsRunnable()
-
getTenantId
public String getTenantId()
-
setTenantId
public void setTenantId(String tenantId)
-
getConfiguration
public AsyncJobExecutorConfiguration getConfiguration()
-
setConfiguration
public void setConfiguration(AsyncJobExecutorConfiguration configuration)
-
-