public class DefaultJobExecutor extends JobExecutor
This is a simple implementation of the JobExecutor
using self-managed
threads for performing background work.
This implementation uses a ThreadPoolExecutor
backed by a queue to which
work is submitted.
NOTE: use this class in environments in which self-management of threads is permitted. Consider using a different thread-management strategy in J(2)EE-Environments.
Modifier and Type | Field and Description |
---|---|
protected int |
corePoolSize |
protected long |
keepAliveTime |
protected int |
maxPoolSize |
protected int |
queueSize |
protected ThreadPoolExecutor |
threadPoolExecutor |
protected BlockingQueue<Runnable> |
threadPoolQueue |
acquireJobsCmd, acquireJobsRunnable, clockReader, commandExecutor, isActive, isAutoActivate, jobAcquisitionThread, lockOwner, lockTimeInMillis, maxJobsPerAcquisition, name, rejectedJobsHandler, waitTimeInMillis
Constructor and Description |
---|
DefaultJobExecutor() |
Modifier and Type | Method and Description |
---|---|
void |
executeJobs(List<String> jobIds) |
int |
getCorePoolSize() |
long |
getKeepAliveTime() |
int |
getMaxPoolSize() |
int |
getQueueSize() |
ThreadPoolExecutor |
getThreadPoolExecutor() |
BlockingQueue<Runnable> |
getThreadPoolQueue() |
void |
setCorePoolSize(int corePoolSize) |
void |
setKeepAliveTime(long keepAliveTime) |
void |
setMaxPoolSize(int maxPoolSize) |
void |
setQueueSize(int queueSize) |
void |
setThreadPoolExecutor(ThreadPoolExecutor threadPoolExecutor) |
void |
setThreadPoolQueue(BlockingQueue<Runnable> threadPoolQueue) |
protected void |
startExecutingJobs() |
protected void |
stopExecutingJobs() |
ensureCleanup, ensureInitialization, getAcquireJobsCmd, getAcquireJobsRunnable, getCommandExecutor, getCurrentTime, getLockOwner, getLockTimeInMillis, getMaxJobsPerAcquisition, getName, getRejectedJobsHandler, getWaitTimeInMillis, isActive, isAutoActivate, jobDone, jobDone, jobWasAdded, setAcquireJobsCmd, setAcquireJobsRunnable, setAutoActivate, setClockReader, setCommandExecutor, setLockOwner, setLockTimeInMillis, setMaxJobsPerAcquisition, setRejectedJobsHandler, setWaitTimeInMillis, shutdown, start, startJobAcquisitionThread, stopJobAcquisitionThread
protected int queueSize
protected int corePoolSize
protected int maxPoolSize
protected long keepAliveTime
protected BlockingQueue<Runnable> threadPoolQueue
protected ThreadPoolExecutor threadPoolExecutor
protected void startExecutingJobs()
startExecutingJobs
in class JobExecutor
protected void stopExecutingJobs()
stopExecutingJobs
in class JobExecutor
public void executeJobs(List<String> jobIds)
executeJobs
in class JobExecutor
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 BlockingQueue<Runnable> getThreadPoolQueue()
public void setThreadPoolQueue(BlockingQueue<Runnable> threadPoolQueue)
public ThreadPoolExecutor getThreadPoolExecutor()
public void setThreadPoolExecutor(ThreadPoolExecutor threadPoolExecutor)
Copyright © 2016 Alfresco. All rights reserved.