Package com.yahoo.concurrent.maintenance
Class JobControl
- java.lang.Object
-
- com.yahoo.concurrent.maintenance.JobControl
-
public class JobControl extends java.lang.Object
Provides status and control over running maintenance jobs. This is multi-thread safe.- Author:
- bratseth
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
JobControl.Db
The database used for managing job state and synchronization
-
Constructor Summary
Constructors Constructor Description JobControl(JobControl.Db db)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<java.lang.String>
inactiveJobs()
Returns a snapshot containing the currently inactive jobs in thisboolean
isActive(java.lang.String jobSimpleClassName)
Returns true if this job is not currently deactivatedjava.util.Set<java.lang.String>
jobs()
Returns a snapshot of the set of jobs started on this system (whether deactivated or not).Mutex
lockJob(java.lang.String jobSimpleClassName)
Acquire lock for running given jobvoid
run(java.lang.String jobSimpleClassName)
Run given job (inactive or not) immediatelyvoid
setActive(java.lang.String jobSimpleClassName, boolean active)
Set a job active or inactivevoid
started(java.lang.String jobSimpleClassName, Maintainer maintainer)
Notifies this that a job was started
-
-
-
Constructor Detail
-
JobControl
public JobControl(JobControl.Db db)
-
-
Method Detail
-
started
public void started(java.lang.String jobSimpleClassName, Maintainer maintainer)
Notifies this that a job was started
-
jobs
public java.util.Set<java.lang.String> jobs()
Returns a snapshot of the set of jobs started on this system (whether deactivated or not). Each job is represented by its simple (omitting package) class name.
-
inactiveJobs
public java.util.Set<java.lang.String> inactiveJobs()
Returns a snapshot containing the currently inactive jobs in this
-
isActive
public boolean isActive(java.lang.String jobSimpleClassName)
Returns true if this job is not currently deactivated
-
setActive
public void setActive(java.lang.String jobSimpleClassName, boolean active)
Set a job active or inactive
-
run
public void run(java.lang.String jobSimpleClassName)
Run given job (inactive or not) immediately
-
lockJob
public Mutex lockJob(java.lang.String jobSimpleClassName)
Acquire lock for running given job
-
-