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 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 configuration
      queueName - The queue name
      statisticsManager - The statistics manager
      queueType - The queue type
      topics - The topics handled by this queue.
  • Method Details

    • getTopics

      public Set<String> 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, and reschedule(String, JobHandler, StatisticsManager) and handleNewTopics(Set) can be called concurrently.
      Parameters:
      jobConsumerManager - The job consumer manager
      statisticsManager - The statistics manager
      queue - The queue
      doFull - 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 name
      handler - The job handler
      statisticsManager - The statistics manager