Class JobManagerImpl

java.lang.Object
org.apache.sling.event.impl.jobs.JobManagerImpl
All Implemented Interfaces:
Runnable, org.apache.sling.event.jobs.JobManager, org.osgi.service.event.EventHandler

public class JobManagerImpl extends Object implements org.apache.sling.event.jobs.JobManager, org.osgi.service.event.EventHandler, Runnable
Implementation of the job manager.
  • Constructor Details

    • JobManagerImpl

      public JobManagerImpl()
  • Method Details

    • activate

      protected void activate(org.osgi.framework.BundleContext ctx, Map<String,Object> props) throws LoginException
      Activate this component.
      Parameters:
      props - Configuration properties
      Throws:
      LoginException
    • deactivate

      protected void deactivate()
      Deactivate this component.
    • run

      public void run()
      This method is invoked periodically by the scheduler. In the default configuration every minute
      Specified by:
      run in interface Runnable
      See Also:
    • handleEvent

      public void handleEvent(org.osgi.service.event.Event event)
      Specified by:
      handleEvent in interface org.osgi.service.event.EventHandler
      See Also:
      • EventHandler.handleEvent(org.osgi.service.event.Event)
    • getStatistics

      public org.apache.sling.event.jobs.Statistics getStatistics()
      Return our internal statistics object.
      Specified by:
      getStatistics in interface org.apache.sling.event.jobs.JobManager
      See Also:
      • JobManager.getStatistics()
    • getTopicStatistics

      public Iterable<org.apache.sling.event.jobs.TopicStatistics> getTopicStatistics()
      Specified by:
      getTopicStatistics in interface org.apache.sling.event.jobs.JobManager
      See Also:
      • JobManager.getTopicStatistics()
    • getQueue

      public org.apache.sling.event.jobs.Queue getQueue(String name)
      Specified by:
      getQueue in interface org.apache.sling.event.jobs.JobManager
      See Also:
      • JobManager.getQueue(java.lang.String)
    • getQueues

      public Iterable<org.apache.sling.event.jobs.Queue> getQueues()
      Specified by:
      getQueues in interface org.apache.sling.event.jobs.JobManager
      See Also:
      • JobManager.getQueues()
    • addJob

      public org.apache.sling.event.jobs.Job addJob(String topic, Map<String,Object> properties)
      Specified by:
      addJob in interface org.apache.sling.event.jobs.JobManager
      See Also:
      • JobManager.addJob(java.lang.String, java.util.Map)
    • getJobById

      public org.apache.sling.event.jobs.Job getJobById(String id)
      Specified by:
      getJobById in interface org.apache.sling.event.jobs.JobManager
      See Also:
      • JobManager.getJobById(java.lang.String)
    • getJob

      public org.apache.sling.event.jobs.Job getJob(String topic, Map<String,Object> template)
      Specified by:
      getJob in interface org.apache.sling.event.jobs.JobManager
      See Also:
      • JobManager.getJob(java.lang.String, java.util.Map)
    • removeJobById

      public boolean removeJobById(String jobId)
      Specified by:
      removeJobById in interface org.apache.sling.event.jobs.JobManager
      See Also:
      • JobManager.removeJobById(java.lang.String)
    • findJobs

      public Collection<org.apache.sling.event.jobs.Job> findJobs(org.apache.sling.event.jobs.JobManager.QueryType type, String topic, long limit, Map<String,Object>... templates)
      Specified by:
      findJobs in interface org.apache.sling.event.jobs.JobManager
      See Also:
      • JobManager.findJobs(org.apache.sling.event.jobs.JobManager.QueryType, java.lang.String, long, java.util.Map[])
    • buildBaseQuery

      protected static String buildBaseQuery(String queryRoot, String topic, org.apache.sling.event.jobs.JobManager.QueryType type, boolean isHistoryQuery)
    • stopJobById

      public void stopJobById(String jobId)
      Specified by:
      stopJobById in interface org.apache.sling.event.jobs.JobManager
      See Also:
      • JobManager.stopJobById(java.lang.String)
    • createJob

      public org.apache.sling.event.jobs.JobBuilder createJob(String topic)
      Specified by:
      createJob in interface org.apache.sling.event.jobs.JobManager
      See Also:
      • JobManager.createJob(java.lang.String)
    • getScheduledJobs

      public Collection<org.apache.sling.event.jobs.ScheduledJobInfo> getScheduledJobs()
      Specified by:
      getScheduledJobs in interface org.apache.sling.event.jobs.JobManager
      See Also:
      • JobManager.getScheduledJobs()
    • getScheduledJobs

      public Collection<org.apache.sling.event.jobs.ScheduledJobInfo> getScheduledJobs(String topic, long limit, Map<String,Object>... templates)
      Specified by:
      getScheduledJobs in interface org.apache.sling.event.jobs.JobManager
      See Also:
      • JobManager.getScheduledJobs()
    • addJob

      public org.apache.sling.event.jobs.Job addJob(String topic, Map<String,Object> properties, List<String> errors)
      Internal method to add a job
    • retryJobById

      public org.apache.sling.event.jobs.Job retryJobById(String jobId)
      Specified by:
      retryJobById in interface org.apache.sling.event.jobs.JobManager
      See Also:
      • JobManager.retryJobById(java.lang.String)
    • getJobScheduler

      public JobSchedulerImpl getJobScheduler()