public class LockFreeJobExecutor extends JobExecutor
| Modifier and Type | Field and Description |
|---|---|
protected int |
corePoolSize
The minimal number of threads that are kept alive in the threadpool for job execution
|
protected Set<String> |
currentlyProcessedJobs
Used to avoid putting the same job twice on the queue
|
protected int |
jobFetchBatchSize
The number of jobs fetched in one query after they are already acquired
|
protected long |
keepAliveTime
The time (in milliseconds) a thread used for job execution must be kept alive before it is
destroyed.
|
protected LockFreeAcquireJobsRunnable |
lockFreeAcquireJobsRunnable
The runnable responsible for fetching the jobs and put on the queue
|
protected int |
maxPoolSize
The maximum number of threads that are kept alive in the threadpool for job execution
|
protected int |
queueSize
The size of the queue on which jobs to be executed are placed
|
protected Map<String,JobEntity> |
recentlyRemovedJobs
When a job is removed from the currentlyProcessedJobs (in the ExecuteJobsRunnable), there can be a
slight window of overlap: the jobs are already fetched in memory, but the removal happened just before.
|
protected long |
secondsToWaitOnShutdown
The time (in seconds) that is waited to gracefully shut down the threadpool used for job execution
|
protected ThreadPoolExecutor |
threadPoolExecutor
The thread pool used for job execution
|
protected BlockingQueue<Runnable> |
threadPoolQueue
The queue used for job execution work
|
acquireJobsCmd, acquireJobsRunnable, clockReader, commandExecutor, isActive, isAutoActivate, jobAcquisitionThread, lockOwner, lockTimeInMillis, maxJobsPerAcquisition, name, rejectedJobsHandler, waitTimeInMillis| Constructor and Description |
|---|
LockFreeJobExecutor() |
ensureCleanup, ensureInitialization, getAcquireJobsCmd, getAcquireJobsRunnable, getCommandExecutor, getCurrentTime, getLockOwner, getLockTimeInMillis, getMaxJobsPerAcquisition, getName, getRejectedJobsHandler, getWaitTimeInMillis, isActive, isAutoActivate, jobDone, jobWasAdded, setAcquireJobsCmd, setAcquireJobsRunnable, setAutoActivate, setClockReader, setCommandExecutor, setLockOwner, setLockTimeInMillis, setMaxJobsPerAcquisition, setRejectedJobsHandler, setWaitTimeInMillis, shutdown, start, stopJobAcquisitionThreadprotected int corePoolSize
protected int maxPoolSize
protected long keepAliveTime
protected Set<String> currentlyProcessedJobs
protected Map<String,JobEntity> recentlyRemovedJobs
protected int queueSize
protected int jobFetchBatchSize
protected BlockingQueue<Runnable> threadPoolQueue
protected ThreadPoolExecutor threadPoolExecutor
protected long secondsToWaitOnShutdown
protected LockFreeAcquireJobsRunnable lockFreeAcquireJobsRunnable
protected void startExecutingJobs()
startExecutingJobs in class JobExecutorprotected void stopExecutingJobs()
stopExecutingJobs in class JobExecutorpublic void executeJobs(List<String> jobIds)
executeJobs in class JobExecutorprotected void startJobAcquisitionThread()
JobExecutorstartJobAcquisitionThread in class JobExecutorprotected void initCurrentlyProcessedDataStructures()
public void jobScheduledForExecution(JobEntity job)
public boolean isJobScheduledForExecution(JobEntity job)
public void jobDone(JobEntity job)
jobDone in class JobExecutorpublic 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 ThreadPoolExecutor getThreadPoolExecutor()
public void setThreadPoolExecutor(ThreadPoolExecutor threadPoolExecutor)
public int getJobFetchBatchSize()
public void setJobFetchBatchSize(int jobFetchBatchSize)
Copyright © 2016 Alfresco. All rights reserved.