@ProviderType
public interface JobManager
Modifier and Type | Interface and Description |
---|---|
static class |
JobManager.QueryType
The requested job types for the query.
|
Modifier and Type | Method and Description |
---|---|
Job |
addJob(String topic,
Map<String,Object> properties)
Add a new job
If the topic is
null or illegal, no job is created and null is returned. |
Job |
addJob(String topic,
String name,
Map<String,Object> properties)
Deprecated.
|
JobBuilder |
createJob(String topic)
Fluent API to create, start and schedule new jobs
|
org.osgi.service.event.Event |
findJob(String topic,
Map<String,Object> template)
Deprecated.
|
Collection<Job> |
findJobs(JobManager.QueryType type,
String topic,
long limit,
Map<String,Object>... templates)
Return all jobs of a given type.
|
void |
forceRemoveJob(String jobId)
Deprecated.
|
Job |
getJob(String topic,
Map<String,Object> template)
Find a job - either scheduled or active.
|
Job |
getJobById(String jobId)
Return a job based on the unique id.
|
Job |
getJobByName(String name)
Deprecated.
|
Queue |
getQueue(String name)
Return a queue with a specific name (if running)
|
Iterable<Queue> |
getQueues()
Return an iterator for all available queues.
|
Collection<ScheduledJobInfo> |
getScheduledJobs()
Return all available job schedules.
|
Collection<ScheduledJobInfo> |
getScheduledJobs(String topic,
long limit,
Map<String,Object>... templates)
Return all matching available job schedules.
|
Statistics |
getStatistics()
Return statistics information about all queues.
|
Iterable<TopicStatistics> |
getTopicStatistics()
Return statistics information about job topics.
|
boolean |
isJobProcessingEnabled()
Deprecated.
This method always returns true
|
JobsIterator |
queryJobs(JobManager.QueryType type,
String topic,
long limit,
Map<String,Object>... templates)
Deprecated.
|
JobsIterator |
queryJobs(JobManager.QueryType type,
String topic,
Map<String,Object>... templates)
Deprecated.
|
boolean |
removeJob(String jobId)
Deprecated.
|
boolean |
removeJobById(String jobId)
Removes the job even if it is currently in processing.
|
void |
restart()
Restart the job manager.
|
Job |
retryJobById(String jobId)
Retry a cancelled job.
|
void |
stopJobById(String jobId)
Stop a job.
|
Statistics getStatistics()
Iterable<TopicStatistics> getTopicStatistics()
Queue getQueue(String name)
name
- The queue namenull
void restart()
Job addJob(String topic, Map<String,Object> properties)
null
or illegal, no job is created and null
is returned.
If properties are provided, all of them must be serializable. If there are non serializable
objects in the properties, no job is created and null
is returned.
A job topic is a hierarchical name separated by dashes, each part has to start with a letter,
allowed characters are letters, numbers and the underscore.
The returned job object is a snapshot of the job state taken at the time of creation. Updates
to the job state are not reflected and the client needs to get a new job object using the job id.
If the queue for processing this job is configured to drop the job, null
is returned
as well.topic
- The required job topic.properties
- Optional job properties. The properties must be serializable.null
if the job could not be created.Job getJobById(String jobId)
jobId
- The unique identifier from Job.getId()
null
boolean removeJobById(String jobId)
jobId
- The unique identifier from Job.getId()
true
if the job could be removed or does not exist anymore.
false
otherwise.Job getJob(String topic, Map<String,Object> template)
topic
- Topic is required.template
- The map acts like a template. The searched job
must match the template (AND query).null
Collection<Job> findJobs(JobManager.QueryType type, String topic, long limit, Map<String,Object>... templates)
type
- Required parameter for the type. See above.topic
- Topic can be used as a filter, if it is non-null, only jobs with this topic will be returned.limit
- A positive number indicating the maximum number of jobs returned by the iterator. A value
of zero or less indicates that all jobs should be returned.templates
- A list of filter property maps. Each map acts like a template. The searched job
must match the template (AND query). By providing several maps, different filters
are possible (OR query).void stopJobById(String jobId)
Job retryJobById(String jobId)
null
.jobId
- The job id.null
JobBuilder createJob(String topic)
topic
- Required topicCollection<ScheduledJobInfo> getScheduledJobs()
Collection<ScheduledJobInfo> getScheduledJobs(String topic, long limit, Map<String,Object>... templates)
topic
- Topic can be used as a filter, if it is non-null, only jobs with this topic will be returned.limit
- A positive number indicating the maximum number of jobs returned by the iterator. A value
of zero or less indicates that all jobs should be returned.templates
- A list of filter property maps. Each map acts like a template. The searched job
must match the template (AND query). By providing several maps, different filters
are possible (OR query).@Deprecated Job addJob(String topic, String name, Map<String,Object> properties)
null
or illegal, no job is created and null
is returned.
If properties are provided, all of them must be serializable. If there are non serializable
objects in the properties, no job is created and null
is returned.
A job topic is a hierarchical name separated by dashes, each part has to start with a letter,
allowed characters are letters, numbers and the underscore.
This method allows to specify a job name which should uniquely identify this job. If a job with
the same name is started on different instances, the job is still processed only once. However,
the topology api in combination with the leader selection provides a better way for
dealing with this situation and as jobs with name come with a heavy processing overhead
these should be avoided.
The returned job object is a snapshot of the job state taken at the time of creation. Updates
to the job state are not reflected and the client needs to get a new job object using the job id.
If the queue for processing this job is configured to drop the job, null
is returned
as well.topic
- The required job topic.name
- Optional unique job nameproperties
- Optional job properties. The properties must be serializable.null
if the job could not be created.@Deprecated Job getJobByName(String name)
null
@Deprecated JobsIterator queryJobs(JobManager.QueryType type, String topic, Map<String,Object>... templates)
findJobs(QueryType, String, long, Map...)
type
- Required parameter for the type: either all jobs, only queued or only started can be returned.topic
- Topic can be used as a filter, if it is non-null, only jobs with this topic will be returned.templates
- A list of filter property maps. Each map acts like a template. The searched job
must match the template (AND query). By providing several maps, different filters
are possible (OR query).@Deprecated JobsIterator queryJobs(JobManager.QueryType type, String topic, long limit, Map<String,Object>... templates)
findJobs(QueryType, String, long, Map...)
type
- Required parameter for the type: either all jobs, only queued or only started can be returned.topic
- Topic can be used as a filter, if it is non-null, only jobs with this topic will be returned.limit
- A positive number indicating the maximum number of jobs returned by the iterator.templates
- A list of filter property maps. Each map acts like a template. The searched job
must match the template (AND query). By providing several maps, different filters
are possible (OR query).@Deprecated org.osgi.service.event.Event findJob(String topic, Map<String,Object> template)
getJob(String, Map)
topic
- Topic is required.template
- The map acts like a template. The searched job
must match the template (AND query).null
@Deprecated boolean removeJob(String jobId)
removeJobById(String)
jobId
- The unique identifier as found in the property JobUtil.JOB_ID
.true
if the job could be cancelled or does not exist anymore.
false
otherwise.@Deprecated void forceRemoveJob(String jobId)
removeJobById(String)
removeJob(String)
with the exception that it waits
for a job to finish. The job will be removed when this method returns - however
this method blocks until the job is finished!jobId
- The unique identifier as found in the property JobUtil.JOB_ID
.@Deprecated boolean isJobProcessingEnabled()
Copyright © 2014 The Apache Software Foundation. All rights reserved.