Class QueueJobCache
java.lang.Object
org.apache.sling.event.impl.jobs.queues.QueueJobCache
The queue job cache caches jobs per queue based on the topics the queue is actively
processing.
-
Constructor Summary
ConstructorDescriptionQueueJobCache
(JobManagerConfiguration configuration, String queueName, StatisticsManager statisticsManager, org.apache.sling.event.jobs.QueueConfiguration.Type queueType, Set<String> topics) Create a new queue job cache -
Method Summary
Modifier and TypeMethodDescriptiongetNextJob
(JobConsumerManager jobConsumerManager, StatisticsManager statisticsManager, org.apache.sling.event.jobs.Queue queue, boolean doFull) Get the next job.All topics of this queue.void
handleNewTopics
(Set<String> topics) Inform the queue cache about topics containing new jobsboolean
isEmpty()
Check whether there are jobs for this queuevoid
reschedule
(String queueName, JobHandler handler, StatisticsManager statisticsManager) Reschedule a job Reschedule the job and add it back into the cache.void
setIsBlocked
(boolean value)
-
Constructor Details
-
QueueJobCache
public QueueJobCache(JobManagerConfiguration configuration, String queueName, StatisticsManager statisticsManager, org.apache.sling.event.jobs.QueueConfiguration.Type queueType, Set<String> topics) Create a new queue job cache- Parameters:
configuration
- Current job manager configurationqueueName
- The queue namestatisticsManager
- The statistics managerqueueType
- The queue typetopics
- The topics handled by this queue.
-
-
Method Details
-
getTopics
All topics of this queue.- Returns:
- The topics.
-
isEmpty
public boolean isEmpty()Check whether there are jobs for this queue- Returns:
true
if there is any job outstanding.
-
setIsBlocked
public void setIsBlocked(boolean value) -
getNextJob
public JobHandler getNextJob(JobConsumerManager jobConsumerManager, StatisticsManager statisticsManager, org.apache.sling.event.jobs.Queue queue, boolean doFull) Get the next job. This method is potentially called concurrently, andreschedule(String, JobHandler, StatisticsManager)
andhandleNewTopics(Set)
can be called concurrently.- Parameters:
jobConsumerManager
- The job consumer managerstatisticsManager
- The statistics managerqueue
- The queuedoFull
- Whether to do a full scan- Returns:
- The job handler or
null
.
-
handleNewTopics
Inform the queue cache about topics containing new jobs- Parameters:
topics
- The set of topics to scan
-
reschedule
Reschedule a job Reschedule the job and add it back into the cache.- Parameters:
queueName
- The queue namehandler
- The job handlerstatisticsManager
- The statistics manager
-