Class JobExecutor
- java.lang.Object
-
- org.camunda.bpm.engine.impl.jobexecutor.JobExecutor
-
- Direct Known Subclasses:
ManagedJobExecutor
,ManagedJobExecutor
,RuntimeContainerJobExecutor
,SpringJobExecutor
,ThreadPoolJobExecutor
public abstract class JobExecutor extends java.lang.Object
Interface to the component responsible for performing background work (
Jobs
).The
JobExecutor
is capable of dispatching to multiple process engines, ie. multiple process engines can share a single Thread Pool for performing Background Work.In clustered situations, you can have multiple Job Executors running against the same queue + pending job list.
- Author:
- Daniel Meyer
-
-
Field Summary
Fields Modifier and Type Field Description protected AcquireJobsCommandFactory
acquireJobsCmdFactory
protected AcquireJobsRunnable
acquireJobsRunnable
protected int
backoffDecreaseThreshold
The number of job acquisition cycles without locking failures until the backoff level is reduced.protected int
backoffTimeInMillis
protected boolean
isActive
protected boolean
isAutoActivate
protected java.lang.Thread
jobAcquisitionThread
protected java.lang.String
lockOwner
protected int
lockTimeInMillis
protected long
maxBackoff
protected int
maxJobsPerAcquisition
protected long
maxWait
protected java.lang.String
name
protected java.util.List<ProcessEngineImpl>
processEngines
protected RejectedJobsHandler
rejectedJobsHandler
protected float
waitIncreaseFactor
protected int
waitTimeInMillis
-
Constructor Summary
Constructors Constructor Description JobExecutor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.util.Iterator<ProcessEngineImpl>
engineIterator()
Must return an iterator of registered process engines that is independent of concurrent modifications to the underlying data structure of engines.protected void
ensureCleanup()
protected void
ensureInitialization()
void
executeJobs(java.util.List<java.lang.String> jobIds)
Deprecated.abstract void
executeJobs(java.util.List<java.lang.String> jobIds, ProcessEngineImpl processEngine)
Command<AcquiredJobs>
getAcquireJobsCmd(int numJobs)
AcquireJobsCommandFactory
getAcquireJobsCmdFactory()
AcquireJobsRunnable
getAcquireJobsRunnable()
int
getBackoffDecreaseThreshold()
int
getBackoffTimeInMillis()
CommandExecutor
getCommandExecutor()
Deprecated.java.lang.Runnable
getExecuteJobsRunnable(java.util.List<java.lang.String> jobIds, ProcessEngineImpl processEngine)
java.lang.String
getLockOwner()
int
getLockTimeInMillis()
long
getMaxBackoff()
int
getMaxJobsPerAcquisition()
long
getMaxWait()
java.lang.String
getName()
java.util.List<ProcessEngineImpl>
getProcessEngines()
RejectedJobsHandler
getRejectedJobsHandler()
float
getWaitIncreaseFactor()
int
getWaitTimeInMillis()
boolean
hasRegisteredEngine(ProcessEngineImpl engine)
boolean
isActive()
boolean
isAutoActivate()
void
jobWasAdded()
void
logAcquiredJobs(ProcessEngineImpl engine, int numJobs)
void
logAcquisitionAttempt(ProcessEngineImpl engine)
void
logAcquisitionFailureJobs(ProcessEngineImpl engine, int numJobs)
void
logRejectedExecution(ProcessEngineImpl engine, int numJobs)
void
registerProcessEngine(ProcessEngineImpl processEngine)
void
setAcquireJobsCmdFactory(AcquireJobsCommandFactory acquireJobsCmdFactory)
void
setAutoActivate(boolean isAutoActivate)
void
setBackoffDecreaseThreshold(int backoffDecreaseThreshold)
void
setBackoffTimeInMillis(int backoffTimeInMillis)
void
setCommandExecutor(CommandExecutor commandExecutorTxRequired)
Deprecated.void
setLockOwner(java.lang.String lockOwner)
void
setLockTimeInMillis(int lockTimeInMillis)
void
setMaxBackoff(long maxBackoff)
void
setMaxJobsPerAcquisition(int maxJobsPerAcquisition)
void
setMaxWait(long maxWait)
void
setProcessEngines(java.util.List<ProcessEngineImpl> processEngines)
void
setRejectedJobsHandler(RejectedJobsHandler rejectedJobsHandler)
void
setWaitIncreaseFactor(float waitIncreaseFactor)
void
setWaitTimeInMillis(int waitTimeInMillis)
void
shutdown()
void
start()
protected abstract void
startExecutingJobs()
protected void
startJobAcquisitionThread()
protected abstract void
stopExecutingJobs()
protected void
stopJobAcquisitionThread()
void
unregisterProcessEngine(ProcessEngineImpl processEngine)
-
-
-
Field Detail
-
name
protected java.lang.String name
-
processEngines
protected java.util.List<ProcessEngineImpl> processEngines
-
acquireJobsCmdFactory
protected AcquireJobsCommandFactory acquireJobsCmdFactory
-
acquireJobsRunnable
protected AcquireJobsRunnable acquireJobsRunnable
-
rejectedJobsHandler
protected RejectedJobsHandler rejectedJobsHandler
-
jobAcquisitionThread
protected java.lang.Thread jobAcquisitionThread
-
isAutoActivate
protected boolean isAutoActivate
-
isActive
protected boolean isActive
-
maxJobsPerAcquisition
protected int maxJobsPerAcquisition
-
waitTimeInMillis
protected int waitTimeInMillis
-
waitIncreaseFactor
protected float waitIncreaseFactor
-
maxWait
protected long maxWait
-
backoffTimeInMillis
protected int backoffTimeInMillis
-
maxBackoff
protected long maxBackoff
-
backoffDecreaseThreshold
protected int backoffDecreaseThreshold
The number of job acquisition cycles without locking failures until the backoff level is reduced.
-
lockOwner
protected java.lang.String lockOwner
-
lockTimeInMillis
protected int lockTimeInMillis
-
-
Method Detail
-
start
public void start()
-
shutdown
public void shutdown()
-
ensureInitialization
protected void ensureInitialization()
-
ensureCleanup
protected void ensureCleanup()
-
jobWasAdded
public void jobWasAdded()
-
registerProcessEngine
public void registerProcessEngine(ProcessEngineImpl processEngine)
-
unregisterProcessEngine
public void unregisterProcessEngine(ProcessEngineImpl processEngine)
-
startExecutingJobs
protected abstract void startExecutingJobs()
-
stopExecutingJobs
protected abstract void stopExecutingJobs()
-
executeJobs
public abstract void executeJobs(java.util.List<java.lang.String> jobIds, ProcessEngineImpl processEngine)
-
executeJobs
@Deprecated public void executeJobs(java.util.List<java.lang.String> jobIds)
Deprecated.Deprecated: useexecuteJobs(List, ProcessEngineImpl)
instead- Parameters:
jobIds
-
-
logAcquisitionAttempt
public void logAcquisitionAttempt(ProcessEngineImpl engine)
-
logAcquiredJobs
public void logAcquiredJobs(ProcessEngineImpl engine, int numJobs)
-
logAcquisitionFailureJobs
public void logAcquisitionFailureJobs(ProcessEngineImpl engine, int numJobs)
-
logRejectedExecution
public void logRejectedExecution(ProcessEngineImpl engine, int numJobs)
-
getProcessEngines
public java.util.List<ProcessEngineImpl> getProcessEngines()
-
engineIterator
public java.util.Iterator<ProcessEngineImpl> engineIterator()
Must return an iterator of registered process engines that is independent of concurrent modifications to the underlying data structure of engines.
-
hasRegisteredEngine
public boolean hasRegisteredEngine(ProcessEngineImpl engine)
-
getCommandExecutor
@Deprecated public CommandExecutor getCommandExecutor()
Deprecated.Deprecated: usegetProcessEngines()
instead
-
setCommandExecutor
@Deprecated public void setCommandExecutor(CommandExecutor commandExecutorTxRequired)
Deprecated.Deprecated: useregisterProcessEngine(ProcessEngineImpl)
instead- Parameters:
commandExecutorTxRequired
-
-
getWaitTimeInMillis
public int getWaitTimeInMillis()
-
setWaitTimeInMillis
public void setWaitTimeInMillis(int waitTimeInMillis)
-
getBackoffTimeInMillis
public int getBackoffTimeInMillis()
-
setBackoffTimeInMillis
public void setBackoffTimeInMillis(int backoffTimeInMillis)
-
getLockTimeInMillis
public int getLockTimeInMillis()
-
setLockTimeInMillis
public void setLockTimeInMillis(int lockTimeInMillis)
-
getLockOwner
public java.lang.String getLockOwner()
-
setLockOwner
public void setLockOwner(java.lang.String lockOwner)
-
isAutoActivate
public boolean isAutoActivate()
-
setProcessEngines
public void setProcessEngines(java.util.List<ProcessEngineImpl> processEngines)
-
setAutoActivate
public void setAutoActivate(boolean isAutoActivate)
-
getMaxJobsPerAcquisition
public int getMaxJobsPerAcquisition()
-
setMaxJobsPerAcquisition
public void setMaxJobsPerAcquisition(int maxJobsPerAcquisition)
-
getWaitIncreaseFactor
public float getWaitIncreaseFactor()
-
setWaitIncreaseFactor
public void setWaitIncreaseFactor(float waitIncreaseFactor)
-
getMaxWait
public long getMaxWait()
-
setMaxWait
public void setMaxWait(long maxWait)
-
getMaxBackoff
public long getMaxBackoff()
-
setMaxBackoff
public void setMaxBackoff(long maxBackoff)
-
getBackoffDecreaseThreshold
public int getBackoffDecreaseThreshold()
-
setBackoffDecreaseThreshold
public void setBackoffDecreaseThreshold(int backoffDecreaseThreshold)
-
getName
public java.lang.String getName()
-
getAcquireJobsCmd
public Command<AcquiredJobs> getAcquireJobsCmd(int numJobs)
-
getAcquireJobsCmdFactory
public AcquireJobsCommandFactory getAcquireJobsCmdFactory()
-
setAcquireJobsCmdFactory
public void setAcquireJobsCmdFactory(AcquireJobsCommandFactory acquireJobsCmdFactory)
-
isActive
public boolean isActive()
-
getRejectedJobsHandler
public RejectedJobsHandler getRejectedJobsHandler()
-
setRejectedJobsHandler
public void setRejectedJobsHandler(RejectedJobsHandler rejectedJobsHandler)
-
startJobAcquisitionThread
protected void startJobAcquisitionThread()
-
stopJobAcquisitionThread
protected void stopJobAcquisitionThread()
-
getAcquireJobsRunnable
public AcquireJobsRunnable getAcquireJobsRunnable()
-
getExecuteJobsRunnable
public java.lang.Runnable getExecuteJobsRunnable(java.util.List<java.lang.String> jobIds, ProcessEngineImpl processEngine)
-
-