public interface JobRegistryService
Keeps the list of Job
instances registered by the runtime and
provides the necessary methods to register and remove jobs, access
registered jobs, as well as register listeners which are notified on job
registrations, removals, and updates.
The following event types are sent to registered listeners:
JobRegistryService.EventType.ADD
event is sent when a job is added.JobRegistryService.EventType.REMOVE
event is sent when a job is removed.JobRegistryService.EventType.UPDATE
event is sent when a job is updated.Modifier and Type | Interface and Description |
---|---|
static class |
JobRegistryService.EventType
Job event types.
|
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.
|
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.
|
void addListener(BiConsumer<JobRegistryService.EventType,Job> listener) throws java.lang.IllegalArgumentException
A listener is notified of all existing jobs when it is first added.
listener
- the listener that will be addedjava.lang.IllegalArgumentException
- if the listener parameter is
null
boolean removeListener(BiConsumer<JobRegistryService.EventType,Job> listener)
listener
- the listener that will be removedjava.util.Set<java.lang.String> getJobIds()
Job getJob(java.lang.String id)
id
- job identifiernull
if no job is registered with that
identifier.void addJob(Job job) throws java.lang.IllegalArgumentException
job
- the job to registerjava.lang.IllegalArgumentException
- if a job is null, or if a job with
the same identifier is already registeredboolean removeJob(java.lang.String jobId)
jobId
- the identifier of the job to removeboolean updateJob(Job job)
job
- the jobCopyright © 2016 The Apache Software Foundation. All Rights Reserved - bbe71fa-20161201-1641