|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.sling.event.impl.jobs.StatisticsImpl
org.apache.sling.event.impl.jobs.DefaultJobManager
@Service(value={java.lang.Runnable.class,JobManager.class,org.osgi.service.event.EventHandler.class})
@Properties(value={@Property(name="scheduler.period",longValue=60L,propertyPrivate=true),@Property(name="scheduler.concurrent",boolValue=false,propertyPrivate=true),@Property(name="queue.priority",value="NORM",options={@PropertyOption(name="NORM",value="Norm"),@PropertyOption(name="MIN",value="Min"),@PropertyOption(name="MAX",value="Max")}),@Property(name="queue.retries",intValue=10),@Property(name="queue.retrydelay",longValue=2000L),@Property(name="queue.maxparallel",intValue=15),@Property(name="event.topics",propertyPrivate=true,value="org/apache/sling/event/notification/job/*")})
public class DefaultJobManagerAn event handler for special job events. We schedule this event handler to run in the background and clean up obsolete queues.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.apache.sling.event.jobs.JobManager |
|---|
JobManager.QueryType |
| Constructor Summary | |
|---|---|
DefaultJobManager()
|
|
| Method Summary | |
|---|---|
protected void |
activate(java.util.Map<java.lang.String,java.lang.Object> props)
Activate this component. |
protected void |
deactivate()
Dectivate this component. |
org.osgi.service.event.Event |
findJob(java.lang.String topic,
java.util.Map<java.lang.String,java.lang.Object> template)
Find a job - either scheduled or active. |
void |
forceRemoveJob(java.lang.String jobId)
Cancel this job. |
InternalQueueConfiguration |
getMainQueueConfiguration()
|
Queue |
getQueue(java.lang.String name)
Return a queue with a specific name (if running) |
java.lang.Iterable<Queue> |
getQueues()
Return an iterator for all available queues. |
Statistics |
getStatistics()
Return our internal statistics object. |
java.lang.Iterable<TopicStatistics> |
getTopicStatistics()
Return statistics information about job topics. |
void |
handleEvent(org.osgi.service.event.Event event)
|
boolean |
isJobProcessingEnabled()
Is job processing enabled? |
void |
notifyActiveJob(java.lang.String key)
Job started |
void |
notifyAddJob(JobEvent job)
Add a job to all jobs. |
void |
notifyRemoveJob(java.lang.String key)
Remove a job from all jobs. |
void |
notifyRescheduleJob(java.lang.String key)
Job started |
void |
process(JobEvent event)
Process a new job event. |
JobsIterator |
queryJobs(JobManager.QueryType type,
java.lang.String topic,
long limit,
java.util.Map<java.lang.String,java.lang.Object>... filterProps)
Return all jobs either running or scheduled. |
JobsIterator |
queryJobs(JobManager.QueryType type,
java.lang.String topic,
java.util.Map<java.lang.String,java.lang.Object>... filterProps)
Return all jobs either running or scheduled. |
boolean |
removeJob(java.lang.String jobId)
Cancel this job. |
void |
reset()
Clear all collected statistics and set the starting time to the current time. |
void |
restart()
Restart the job manager. |
void |
run()
This method is invoked periodically by the scheduler. |
protected void |
update(java.util.Map<java.lang.String,java.lang.Object> props)
Configure this component. |
| Methods inherited from class org.apache.sling.event.impl.jobs.StatisticsImpl |
|---|
add, addActive, cancelledJob, clearQueued, copyFrom, decQueued, failedJob, finishedJob, getAverageProcessingTime, getAverageWaitingTime, getLastActivatedJobTime, getLastFinishedJobTime, getNumberOfActiveJobs, getNumberOfCancelledJobs, getNumberOfFailedJobs, getNumberOfFinishedJobs, getNumberOfJobs, getNumberOfProcessedJobs, getNumberOfQueuedJobs, getStartTime, incQueued |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultJobManager()
| Method Detail |
|---|
@Activate protected void activate(java.util.Map<java.lang.String,java.lang.Object> props)
props - Configuration properties@Modified protected void update(java.util.Map<java.lang.String,java.lang.Object> props)
props - Configuration properties@Deactivate protected void deactivate()
public void process(JobEvent event)
event - The job eventpublic void run()
run in interface java.lang.RunnableRunnable.run()public Statistics getStatistics()
getStatistics in interface JobManagerJobManager.getStatistics()public Queue getQueue(java.lang.String name)
JobManager
getQueue in interface JobManagername - The queue name
nullJobManager.getQueue(java.lang.String)public java.lang.Iterable<Queue> getQueues()
JobManager
getQueues in interface JobManagerJobManager.getQueues()public InternalQueueConfiguration getMainQueueConfiguration()
public void notifyAddJob(JobEvent job)
public void notifyRemoveJob(java.lang.String key)
public void notifyActiveJob(java.lang.String key)
public void notifyRescheduleJob(java.lang.String key)
public JobsIterator queryJobs(JobManager.QueryType type,
java.lang.String topic,
java.util.Map<java.lang.String,java.lang.Object>... filterProps)
JobManager
queryJobs in interface JobManagertype - 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.filterProps - 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).
JobManager.queryJobs(QueryType, java.lang.String, java.util.Map...)
public JobsIterator queryJobs(JobManager.QueryType type,
java.lang.String topic,
long limit,
java.util.Map<java.lang.String,java.lang.Object>... filterProps)
JobManager
queryJobs in interface JobManagertype - 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.filterProps - 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).
JobManager.queryJobs(QueryType, java.lang.String, long, java.util.Map...)
public org.osgi.service.event.Event findJob(java.lang.String topic,
java.util.Map<java.lang.String,java.lang.Object> template)
JobManager
findJob in interface JobManagertopic - Topic is required.template - The map acts like a template. The searched job
must match the template (AND query).
nullJobManager.findJob(java.lang.String, java.util.Map)public boolean removeJob(java.lang.String jobId)
JobManager
removeJob in interface JobManagerjobId - The unique identifer as found in the property JobUtil.JOB_ID.
true if the job could be cancelled or does not exist anymore.
false otherwise.JobManager.removeJob(java.lang.String)public void forceRemoveJob(java.lang.String jobId)
JobManagerJobManager.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!
forceRemoveJob in interface JobManagerjobId - The unique identifer as found in the property JobUtil.JOB_ID.JobManager.forceRemoveJob(java.lang.String)public void reset()
Statistics
reset in interface Statisticsreset in class StatisticsImplReset this statistics and all queues.public java.lang.Iterable<TopicStatistics> getTopicStatistics()
JobManager
getTopicStatistics in interface JobManagerJobManager.getTopicStatistics()public void handleEvent(org.osgi.service.event.Event event)
handleEvent in interface org.osgi.service.event.EventHandlerEventHandler.handleEvent(org.osgi.service.event.Event)public void restart()
JobManager
restart in interface JobManagerJobManager.restart()public boolean isJobProcessingEnabled()
JobManager
isJobProcessingEnabled in interface JobManagerJobManager.isJobProcessingEnabled()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||