public abstract class JobExecutor extends Object
Interface to the work management component of activiti.
This component is responsible for performing all background work
(Jobs
) scheduled by activiti.
You should generally only have one of these per Activiti instance (process engine) in a JVM. In clustered situations, you can have multiple of these running against the same queue + pending job list.
Modifier and Type | Field and Description |
---|---|
protected Command<AcquiredJobs> |
acquireJobsCmd |
protected AcquireJobsRunnable |
acquireJobsRunnable |
protected ClockReader |
clockReader |
protected CommandExecutor |
commandExecutor |
protected boolean |
isActive |
protected boolean |
isAutoActivate |
protected Thread |
jobAcquisitionThread |
protected String |
lockOwner |
protected int |
lockTimeInMillis |
protected int |
maxJobsPerAcquisition
To avoid deadlocks, the default for this is one.
|
protected String |
name |
protected RejectedJobsHandler |
rejectedJobsHandler |
protected long |
waitTimeInMillis |
Constructor and Description |
---|
JobExecutor() |
Modifier and Type | Method and Description |
---|---|
protected void |
ensureCleanup()
Possibility to clean up resources
|
protected void |
ensureInitialization()
Possibility to ensure everything is nicely initialized before starting the threads
|
abstract void |
executeJobs(List<String> jobIds) |
Command<AcquiredJobs> |
getAcquireJobsCmd() |
AcquireJobsRunnable |
getAcquireJobsRunnable() |
CommandExecutor |
getCommandExecutor() |
Date |
getCurrentTime() |
String |
getLockOwner() |
int |
getLockTimeInMillis() |
int |
getMaxJobsPerAcquisition() |
String |
getName() |
RejectedJobsHandler |
getRejectedJobsHandler() |
long |
getWaitTimeInMillis() |
boolean |
isActive() |
boolean |
isAutoActivate() |
void |
jobDone(JobEntity job) |
void |
jobDone(String jobId) |
void |
jobWasAdded()
Called when a new job was added by the process engine to which
this job executor belongs.
|
void |
setAcquireJobsCmd(Command<AcquiredJobs> acquireJobsCmd) |
void |
setAcquireJobsRunnable(AcquireJobsRunnable acquireJobsRunnable) |
void |
setAutoActivate(boolean isAutoActivate) |
void |
setClockReader(ClockReader clockReader) |
void |
setCommandExecutor(CommandExecutor commandExecutor) |
void |
setLockOwner(String lockOwner) |
void |
setLockTimeInMillis(int lockTimeInMillis) |
void |
setMaxJobsPerAcquisition(int maxJobsPerAcquisition) |
void |
setRejectedJobsHandler(RejectedJobsHandler rejectedJobsHandler) |
void |
setWaitTimeInMillis(int waitTimeInMillis) |
void |
shutdown()
Shuts down the whole job executor
|
void |
start()
Starts the job executor
|
protected abstract void |
startExecutingJobs() |
protected void |
startJobAcquisitionThread()
Starts the acquisition thread
|
protected abstract void |
stopExecutingJobs() |
protected void |
stopJobAcquisitionThread()
Stops the acquisition thread
|
protected String name
protected CommandExecutor commandExecutor
protected Command<AcquiredJobs> acquireJobsCmd
protected AcquireJobsRunnable acquireJobsRunnable
protected RejectedJobsHandler rejectedJobsHandler
protected Thread jobAcquisitionThread
protected boolean isAutoActivate
protected boolean isActive
protected int maxJobsPerAcquisition
protected long waitTimeInMillis
protected String lockOwner
protected int lockTimeInMillis
protected ClockReader clockReader
public void start()
public void shutdown()
protected void ensureInitialization()
protected void ensureCleanup()
public void jobWasAdded()
protected void startJobAcquisitionThread()
protected void stopJobAcquisitionThread()
protected abstract void startExecutingJobs()
protected abstract void stopExecutingJobs()
public void jobDone(JobEntity job)
public void jobDone(String jobId)
public CommandExecutor getCommandExecutor()
public long getWaitTimeInMillis()
public void setWaitTimeInMillis(int waitTimeInMillis)
public int getLockTimeInMillis()
public void setLockTimeInMillis(int lockTimeInMillis)
public String getLockOwner()
public void setLockOwner(String lockOwner)
public boolean isAutoActivate()
public void setCommandExecutor(CommandExecutor commandExecutor)
public void setAutoActivate(boolean isAutoActivate)
public int getMaxJobsPerAcquisition()
public void setMaxJobsPerAcquisition(int maxJobsPerAcquisition)
public String getName()
public Command<AcquiredJobs> getAcquireJobsCmd()
public void setAcquireJobsCmd(Command<AcquiredJobs> acquireJobsCmd)
public AcquireJobsRunnable getAcquireJobsRunnable()
public void setAcquireJobsRunnable(AcquireJobsRunnable acquireJobsRunnable)
public boolean isActive()
public RejectedJobsHandler getRejectedJobsHandler()
public void setRejectedJobsHandler(RejectedJobsHandler rejectedJobsHandler)
public Date getCurrentTime()
public void setClockReader(ClockReader clockReader)
Copyright © 2016 Alfresco. All rights reserved.