public class DefaultAsyncJobExecutor extends Object implements AsyncExecutor
Modifier and Type | Field and Description |
---|---|
protected Thread |
asyncJobAcquisitionThread |
protected int |
asyncJobLockTimeInMillis |
protected AcquireAsyncJobsDueRunnable |
asyncJobsDueRunnable |
protected int |
corePoolSize
The minimal number of threads that are kept alive in the threadpool for job execution
|
protected int |
defaultAsyncJobAcquireWaitTimeInMillis |
protected int |
defaultQueueSizeFullWaitTime |
protected int |
defaultTimerJobAcquireWaitTimeInMillis |
protected ExecuteAsyncRunnableFactory |
executeAsyncRunnableFactory |
protected ExecutorService |
executorService
The executor service used for job execution
|
protected boolean |
isActive |
protected boolean |
isAutoActivate |
protected boolean |
isMessageQueueMode |
protected long |
keepAliveTime
The time (in milliseconds) a thread used for job execution must be kept alive before it is destroyed.
|
protected String |
lockOwner |
protected int |
maxAsyncJobsDuePerAcquisition |
protected int |
maxPoolSize
The maximum number of threads that are kept alive in the threadpool for job execution
|
protected int |
maxTimerJobsPerAcquisition |
protected ProcessEngineConfigurationImpl |
processEngineConfiguration |
protected int |
queueSize
The size of the queue on which jobs to be executed are placed
|
protected int |
resetExpiredJobsInterval |
protected int |
resetExpiredJobsPageSize |
protected ResetExpiredJobsRunnable |
resetExpiredJobsRunnable |
protected Thread |
resetExpiredJobThread |
protected int |
retryWaitTimeInMillis |
protected long |
secondsToWaitOnShutdown
The time (in seconds) that is waited to gracefully shut down the threadpool used for job execution
|
protected LinkedList<Job> |
temporaryJobQueue |
protected BlockingQueue<Runnable> |
threadPoolQueue
The queue used for job execution work
|
protected Thread |
timerJobAcquisitionThread |
protected AcquireTimerJobsRunnable |
timerJobRunnable |
protected int |
timerLockTimeInMillis |
Constructor and Description |
---|
DefaultAsyncJobExecutor() |
protected int corePoolSize
protected int maxPoolSize
protected long keepAliveTime
protected int queueSize
protected BlockingQueue<Runnable> threadPoolQueue
protected ExecutorService executorService
protected long secondsToWaitOnShutdown
protected Thread timerJobAcquisitionThread
protected Thread asyncJobAcquisitionThread
protected Thread resetExpiredJobThread
protected AcquireTimerJobsRunnable timerJobRunnable
protected AcquireAsyncJobsDueRunnable asyncJobsDueRunnable
protected ResetExpiredJobsRunnable resetExpiredJobsRunnable
protected ExecuteAsyncRunnableFactory executeAsyncRunnableFactory
protected boolean isAutoActivate
protected boolean isActive
protected boolean isMessageQueueMode
protected int maxTimerJobsPerAcquisition
protected int maxAsyncJobsDuePerAcquisition
protected int defaultTimerJobAcquireWaitTimeInMillis
protected int defaultAsyncJobAcquireWaitTimeInMillis
protected int defaultQueueSizeFullWaitTime
protected String lockOwner
protected int timerLockTimeInMillis
protected int asyncJobLockTimeInMillis
protected int retryWaitTimeInMillis
protected int resetExpiredJobsInterval
protected int resetExpiredJobsPageSize
protected LinkedList<Job> temporaryJobQueue
protected ProcessEngineConfigurationImpl processEngineConfiguration
public boolean executeAsyncJob(Job job)
AsyncExecutor
JobEntity
to this AsyncExecutor
instance
to execute. If the offering does not work for some reason, false
will be returned (For example when the job queue is full in the DefaultAsyncJobExecutor
).executeAsyncJob
in interface AsyncExecutor
public void start()
start
in interface AsyncExecutor
protected void executeTemporaryJobs()
public void shutdown()
shutdown
in interface AsyncExecutor
protected void initAsyncJobExecutionThreadPool()
protected void stopExecutingAsyncJobs()
protected void startJobAcquisitionThread()
protected void startTimerAcquisitionThread()
protected void stopJobAcquisitionThread()
protected void stopTimerAcquisitionThread()
protected void startResetExpiredJobsThread()
protected void stopResetExpiredJobsThread()
public ProcessEngineConfigurationImpl getProcessEngineConfiguration()
getProcessEngineConfiguration
in interface AsyncExecutor
public void setProcessEngineConfiguration(ProcessEngineConfigurationImpl processEngineConfiguration)
setProcessEngineConfiguration
in interface AsyncExecutor
public Thread getTimerJobAcquisitionThread()
public void setTimerJobAcquisitionThread(Thread timerJobAcquisitionThread)
public Thread getAsyncJobAcquisitionThread()
public void setAsyncJobAcquisitionThread(Thread asyncJobAcquisitionThread)
public Thread getResetExpiredJobThread()
public void setResetExpiredJobThread(Thread resetExpiredJobThread)
public boolean isAutoActivate()
isAutoActivate
in interface AsyncExecutor
public void setAutoActivate(boolean isAutoActivate)
setAutoActivate
in interface AsyncExecutor
public boolean isActive()
isActive
in interface AsyncExecutor
public boolean isMessageQueueMode()
public void setMessageQueueMode(boolean isMessageQueueMode)
public int getQueueSize()
public void setQueueSize(int queueSize)
public int getCorePoolSize()
public void setCorePoolSize(int corePoolSize)
public int getMaxPoolSize()
public void setMaxPoolSize(int maxPoolSize)
public long getKeepAliveTime()
public void setKeepAliveTime(long keepAliveTime)
public long getSecondsToWaitOnShutdown()
public void setSecondsToWaitOnShutdown(long secondsToWaitOnShutdown)
public BlockingQueue<Runnable> getThreadPoolQueue()
public void setThreadPoolQueue(BlockingQueue<Runnable> threadPoolQueue)
public ExecutorService getExecutorService()
public void setExecutorService(ExecutorService executorService)
public String getLockOwner()
getLockOwner
in interface AsyncExecutor
public void setLockOwner(String lockOwner)
public int getTimerLockTimeInMillis()
getTimerLockTimeInMillis
in interface AsyncExecutor
public void setTimerLockTimeInMillis(int timerLockTimeInMillis)
setTimerLockTimeInMillis
in interface AsyncExecutor
public int getAsyncJobLockTimeInMillis()
getAsyncJobLockTimeInMillis
in interface AsyncExecutor
public void setAsyncJobLockTimeInMillis(int asyncJobLockTimeInMillis)
setAsyncJobLockTimeInMillis
in interface AsyncExecutor
public int getMaxTimerJobsPerAcquisition()
getMaxTimerJobsPerAcquisition
in interface AsyncExecutor
public void setMaxTimerJobsPerAcquisition(int maxTimerJobsPerAcquisition)
setMaxTimerJobsPerAcquisition
in interface AsyncExecutor
public int getMaxAsyncJobsDuePerAcquisition()
getMaxAsyncJobsDuePerAcquisition
in interface AsyncExecutor
public void setMaxAsyncJobsDuePerAcquisition(int maxAsyncJobsDuePerAcquisition)
setMaxAsyncJobsDuePerAcquisition
in interface AsyncExecutor
public int getDefaultTimerJobAcquireWaitTimeInMillis()
getDefaultTimerJobAcquireWaitTimeInMillis
in interface AsyncExecutor
public void setDefaultTimerJobAcquireWaitTimeInMillis(int defaultTimerJobAcquireWaitTimeInMillis)
setDefaultTimerJobAcquireWaitTimeInMillis
in interface AsyncExecutor
public int getDefaultAsyncJobAcquireWaitTimeInMillis()
getDefaultAsyncJobAcquireWaitTimeInMillis
in interface AsyncExecutor
public void setDefaultAsyncJobAcquireWaitTimeInMillis(int defaultAsyncJobAcquireWaitTimeInMillis)
setDefaultAsyncJobAcquireWaitTimeInMillis
in interface AsyncExecutor
public void setTimerJobRunnable(AcquireTimerJobsRunnable timerJobRunnable)
public int getDefaultQueueSizeFullWaitTimeInMillis()
getDefaultQueueSizeFullWaitTimeInMillis
in interface AsyncExecutor
public void setDefaultQueueSizeFullWaitTimeInMillis(int defaultQueueSizeFullWaitTime)
setDefaultQueueSizeFullWaitTimeInMillis
in interface AsyncExecutor
public void setAsyncJobsDueRunnable(AcquireAsyncJobsDueRunnable asyncJobsDueRunnable)
public void setResetExpiredJobsRunnable(ResetExpiredJobsRunnable resetExpiredJobsRunnable)
public int getRetryWaitTimeInMillis()
getRetryWaitTimeInMillis
in interface AsyncExecutor
public void setRetryWaitTimeInMillis(int retryWaitTimeInMillis)
setRetryWaitTimeInMillis
in interface AsyncExecutor
public int getResetExpiredJobsInterval()
getResetExpiredJobsInterval
in interface AsyncExecutor
public void setResetExpiredJobsInterval(int resetExpiredJobsInterval)
setResetExpiredJobsInterval
in interface AsyncExecutor
public int getResetExpiredJobsPageSize()
getResetExpiredJobsPageSize
in interface AsyncExecutor
public void setResetExpiredJobsPageSize(int resetExpiredJobsPageSize)
setResetExpiredJobsPageSize
in interface AsyncExecutor
public ExecuteAsyncRunnableFactory getExecuteAsyncRunnableFactory()
public void setExecuteAsyncRunnableFactory(ExecuteAsyncRunnableFactory executeAsyncRunnableFactory)
Copyright © 2010–2018 Alfresco. All rights reserved.