public class JobSchedulerImpl extends Object implements ConfigurationChangeListener, org.apache.sling.api.resource.observation.ResourceChangeListener, org.apache.sling.api.resource.observation.ExternalResourceChangeListener, org.apache.sling.commons.scheduler.Job
| Constructor and Description |
|---|
JobSchedulerImpl(JobManagerConfiguration configuration,
org.apache.sling.commons.scheduler.Scheduler scheduler,
JobManagerImpl jobManager)
Create the scheduler
|
| Modifier and Type | Method and Description |
|---|---|
org.apache.sling.event.jobs.ScheduledJobInfo |
addScheduledJob(String topic,
Map<String,Object> properties,
String scheduleName,
boolean isSuspended,
List<ScheduleInfoImpl> scheduleInfos,
List<String> errors)
Add a scheduled job
|
void |
configurationChanged(boolean processingActive)
Notify about a configuration change.
|
org.apache.sling.event.jobs.JobBuilder.ScheduleBuilder |
createJobBuilder(ScheduledJobInfoImpl info)
Create a schedule builder for a currently scheduled job
|
void |
deactivate()
Deactivate this component.
|
void |
execute(org.apache.sling.commons.scheduler.JobContext context) |
Collection<org.apache.sling.event.jobs.ScheduledJobInfo> |
getScheduledJobs(String topic,
long limit,
Map<String,Object>... templates)
Get all scheduled jobs
|
int |
getTotalNumberOfScheduledJobs()
Provide the total number of jobs registered in the system, irrespective of topics
|
void |
handleEvent(org.osgi.service.event.Event event) |
void |
maintenance() |
void |
onChange(List<org.apache.sling.api.resource.observation.ResourceChange> changes) |
void |
removeJob(ScheduledJobInfoImpl info)
Remove a scheduled job
|
void |
scheduleJob(ScheduledJobInfoImpl info)
Add a scheduled job
|
void |
setSuspended(ScheduledJobInfoImpl info,
boolean flag)
Change the suspended flag for a scheduled job
|
void |
unscheduleJob(ScheduledJobInfoImpl info)
Unschedule a scheduled job
|
public JobSchedulerImpl(JobManagerConfiguration configuration, org.apache.sling.commons.scheduler.Scheduler scheduler, JobManagerImpl jobManager)
configuration - Central job manager configurationscheduler - The scheduler servicejobManager - The job managerpublic void deactivate()
public void configurationChanged(boolean processingActive)
ConfigurationChangeListenerconfigurationChanged in interface ConfigurationChangeListenerprocessingActive - true if job processing is active, otherwise falseConfigurationChangeListener.configurationChanged(boolean)public void scheduleJob(ScheduledJobInfoImpl info)
public void unscheduleJob(ScheduledJobInfoImpl info)
public void removeJob(ScheduledJobInfoImpl info)
public void execute(org.apache.sling.commons.scheduler.JobContext context)
execute in interface org.apache.sling.commons.scheduler.JobJob.execute(org.apache.sling.commons.scheduler.JobContext)public void handleEvent(org.osgi.service.event.Event event)
EventHandler.handleEvent(org.osgi.service.event.Event)public org.apache.sling.event.jobs.JobBuilder.ScheduleBuilder createJobBuilder(ScheduledJobInfoImpl info)
public Collection<org.apache.sling.event.jobs.ScheduledJobInfo> getScheduledJobs(String topic, long limit, Map<String,Object>... templates)
public int getTotalNumberOfScheduledJobs()
public void setSuspended(ScheduledJobInfoImpl info, boolean flag)
info - The schedule infoflag - The corresponding flagpublic org.apache.sling.event.jobs.ScheduledJobInfo addScheduledJob(String topic, Map<String,Object> properties, String scheduleName, boolean isSuspended, List<ScheduleInfoImpl> scheduleInfos, List<String> errors)
topic - The job topicproperties - The job propertiesscheduleName - The schedule nameisSuspended - Whether it is suspendedscheduleInfos - The scheduling informationerrors - Optional list to contain potential errorsnullpublic void maintenance()
public void onChange(List<org.apache.sling.api.resource.observation.ResourceChange> changes)
onChange in interface org.apache.sling.api.resource.observation.ResourceChangeListenerResourceChangeListener.onChange(java.util.List)Copyright © 2007–2023 The Apache Software Foundation. All rights reserved.