Class QueueJobCache
- java.lang.Object
-
- org.apache.sling.event.impl.jobs.queues.QueueJobCache
-
public class QueueJobCache extends Object
The queue job cache caches jobs per queue based on the topics the queue is actively processing.
-
-
Constructor Summary
Constructors Constructor Description QueueJobCache(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JobHandlergetNextJob(JobConsumerManager jobConsumerManager, StatisticsManager statisticsManager, org.apache.sling.event.jobs.Queue queue, boolean doFull)Get the next job.Set<String>getTopics()All topics of this queue.voidhandleNewTopics(Set<String> topics)Inform the queue cache about topics containing new jobsbooleanisEmpty()Check whether there are jobs for this queuevoidreschedule(String queueName, JobHandler handler, StatisticsManager statisticsManager)Reschedule a job Reschedule the job and add it back into the cache.voidsetIsBlocked(boolean value)
-
-
-
Constructor Detail
-
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 Detail
-
isEmpty
public boolean isEmpty()
Check whether there are jobs for this queue- Returns:
trueif 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
public void handleNewTopics(Set<String> topics)
Inform the queue cache about topics containing new jobs- Parameters:
topics- The set of topics to scan
-
reschedule
public void reschedule(String queueName, JobHandler handler, StatisticsManager statisticsManager)
Reschedule a job Reschedule the job and add it back into the cache.- Parameters:
queueName- The queue namehandler- The job handlerstatisticsManager- The statistics manager
-
-