public class JobRegistry extends java.lang.Object implements JobRegistryService
JobRegistryService.EventType
Constructor and Description |
---|
JobRegistry()
Creates a new
JobRegistry . |
Modifier and Type | Method and Description |
---|---|
void |
addJob(Job job)
Adds the specified job.
|
void |
addListener(BiConsumer<JobRegistryService.EventType,Job> listener)
Adds a handler to a collection of listeners that will be notified
on job registration and state changes.
|
static JobRegistryService |
createAndRegister(ServiceContainer services)
Creates and registers a
JobRegistry with the given service
container. |
Job |
getJob(java.lang.String id)
Returns a job given its identifier.
|
java.util.Set<java.lang.String> |
getJobIds()
Returns a set of all the registered job identifiers.
|
boolean |
removeJob(java.lang.String jobId)
Removes the job specified by the given identifier.
|
boolean |
removeListener(BiConsumer<JobRegistryService.EventType,Job> listener)
Removes a handler from this registry's collection of listeners.
|
boolean |
updateJob(Job job)
Notifies listeners that the specified registered job has
been updated.
|
public JobRegistry()
JobRegistry
.public static JobRegistryService createAndRegister(ServiceContainer services)
JobRegistry
with the given service
container.services
- provides access to service registrationpublic void addListener(BiConsumer<JobRegistryService.EventType,Job> listener)
JobRegistryService
A listener is notified of all existing jobs when it is first added.
addListener
in interface JobRegistryService
listener
- the listener that will be addedpublic boolean removeListener(BiConsumer<JobRegistryService.EventType,Job> listener)
JobRegistryService
removeListener
in interface JobRegistryService
listener
- the listener that will be removedpublic java.util.Set<java.lang.String> getJobIds()
JobRegistryService
getJobIds
in interface JobRegistryService
public Job getJob(java.lang.String id)
JobRegistryService
getJob
in interface JobRegistryService
id
- job identifiernull
if no job is registered with that
identifier.public boolean removeJob(java.lang.String jobId)
JobRegistryService
removeJob
in interface JobRegistryService
jobId
- the identifier of the job to removepublic void addJob(Job job) throws java.lang.IllegalArgumentException
JobRegistryService
addJob
in interface JobRegistryService
job
- the job to registerjava.lang.IllegalArgumentException
- if a job is null, or if a job with
the same identifier is already registeredpublic boolean updateJob(Job job)
JobRegistryService
updateJob
in interface JobRegistryService
job
- the jobCopyright © 2016 The Apache Software Foundation. All Rights Reserved - bbe71fa-20161201-1641