public class DefaultAsyncJobExecutor extends Object implements AsyncExecutor
| Modifier and Type | Field and Description |
|---|---|
protected Thread |
asyncJobAcquisitionThread |
protected int |
asyncJobLockTimeInMillis |
protected AcquireAsyncJobsDueRunnable |
asyncJobsDueRunnable |
protected CommandExecutor |
commandExecutor |
protected int |
corePoolSize
The minimal number of threads that are kept alive in the threadpool for job execution
|
protected int |
defaultAsyncJobAcquireWaitTimeInMillis |
protected int |
defaultTimerJobAcquireWaitTimeInMillis |
protected ExecuteAsyncRunnableFactory |
executeAsyncRunnableFactory |
protected ExecutorService |
executorService
The executor service used for job execution
|
protected boolean |
isActive |
protected boolean |
isAutoActivate |
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 int |
queueSize
The size of the queue on which jobs to be executed are placed
|
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<JobEntity> |
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 AcquireTimerJobsRunnable timerJobRunnable
protected AcquireAsyncJobsDueRunnable asyncJobsDueRunnable
protected ExecuteAsyncRunnableFactory executeAsyncRunnableFactory
protected boolean isAutoActivate
protected boolean isActive
protected int maxTimerJobsPerAcquisition
protected int maxAsyncJobsDuePerAcquisition
protected int defaultTimerJobAcquireWaitTimeInMillis
protected int defaultAsyncJobAcquireWaitTimeInMillis
protected String lockOwner
protected int timerLockTimeInMillis
protected int asyncJobLockTimeInMillis
protected int retryWaitTimeInMillis
protected LinkedList<JobEntity> temporaryJobQueue
protected CommandExecutor commandExecutor
public void executeAsyncJob(JobEntity job)
executeAsyncJob in interface AsyncExecutorpublic void start()
start in interface AsyncExecutorpublic void shutdown()
shutdown in interface AsyncExecutorprotected void startExecutingAsyncJobs()
protected void stopExecutingAsyncJobs()
protected void startJobAcquisitionThread()
protected void stopJobAcquisitionThread()
public CommandExecutor getCommandExecutor()
getCommandExecutor in interface AsyncExecutorpublic void setCommandExecutor(CommandExecutor commandExecutor)
setCommandExecutor in interface AsyncExecutorpublic boolean isAutoActivate()
isAutoActivate in interface AsyncExecutorpublic void setAutoActivate(boolean isAutoActivate)
setAutoActivate in interface AsyncExecutorpublic boolean isActive()
isActive in interface AsyncExecutorpublic 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 AsyncExecutorpublic void setLockOwner(String lockOwner)
public int getTimerLockTimeInMillis()
getTimerLockTimeInMillis in interface AsyncExecutorpublic void setTimerLockTimeInMillis(int timerLockTimeInMillis)
setTimerLockTimeInMillis in interface AsyncExecutorpublic int getAsyncJobLockTimeInMillis()
getAsyncJobLockTimeInMillis in interface AsyncExecutorpublic void setAsyncJobLockTimeInMillis(int asyncJobLockTimeInMillis)
setAsyncJobLockTimeInMillis in interface AsyncExecutorpublic int getMaxTimerJobsPerAcquisition()
getMaxTimerJobsPerAcquisition in interface AsyncExecutorpublic void setMaxTimerJobsPerAcquisition(int maxTimerJobsPerAcquisition)
setMaxTimerJobsPerAcquisition in interface AsyncExecutorpublic int getMaxAsyncJobsDuePerAcquisition()
getMaxAsyncJobsDuePerAcquisition in interface AsyncExecutorpublic void setMaxAsyncJobsDuePerAcquisition(int maxAsyncJobsDuePerAcquisition)
setMaxAsyncJobsDuePerAcquisition in interface AsyncExecutorpublic int getDefaultTimerJobAcquireWaitTimeInMillis()
getDefaultTimerJobAcquireWaitTimeInMillis in interface AsyncExecutorpublic void setDefaultTimerJobAcquireWaitTimeInMillis(int defaultTimerJobAcquireWaitTimeInMillis)
setDefaultTimerJobAcquireWaitTimeInMillis in interface AsyncExecutorpublic int getDefaultAsyncJobAcquireWaitTimeInMillis()
getDefaultAsyncJobAcquireWaitTimeInMillis in interface AsyncExecutorpublic void setDefaultAsyncJobAcquireWaitTimeInMillis(int defaultAsyncJobAcquireWaitTimeInMillis)
setDefaultAsyncJobAcquireWaitTimeInMillis in interface AsyncExecutorpublic void setTimerJobRunnable(AcquireTimerJobsRunnable timerJobRunnable)
public void setAsyncJobsDueRunnable(AcquireAsyncJobsDueRunnable asyncJobsDueRunnable)
public int getRetryWaitTimeInMillis()
getRetryWaitTimeInMillis in interface AsyncExecutorpublic void setRetryWaitTimeInMillis(int retryWaitTimeInMillis)
setRetryWaitTimeInMillis in interface AsyncExecutorpublic ExecuteAsyncRunnableFactory getExecuteAsyncRunnableFactory()
public void setExecuteAsyncRunnableFactory(ExecuteAsyncRunnableFactory executeAsyncRunnableFactory)
Copyright © 2015 Alfresco. All rights reserved.