Search in sources :

Example 6 with QuartzScheduler

use of com.thinkbiganalytics.scheduler.QuartzScheduler in project kylo by Teradata.

the class DefaultServiceLevelAgreementScheduler method disableServiceLevelAgreement.

/**
 * Used to disable the schedule of the SLA, so that it no longer executes until subsequently re-enabled
 *
 * @param sla The SLA to disable
 */
public void disableServiceLevelAgreement(ServiceLevelAgreement sla) {
    ServiceLevelAgreement.ID slaId = sla.getId();
    JobIdentifier scheduledJobId = null;
    if (scheduledJobNames.containsKey(slaId)) {
        scheduledJobId = jobIdentifierForName(scheduledJobNames.get(slaId));
    } else {
        scheduledJobId = jobIdentifierForName(sla.getName());
    }
    QuartzScheduler scheduler = (QuartzScheduler) jobScheduler;
    if (scheduledJobId != null && scheduler.jobExists(scheduledJobId)) {
        try {
            jobScheduler.pauseTriggersOnJob(scheduledJobId);
        } catch (JobSchedulerException e) {
            log.error("Unable to pause the schedule for the disabled SLA {} ", sla.getName());
        }
    } else {
        log.info("Unable to pause the SLA job {} .  The Job does not exist", sla.getName());
    }
}
Also used : JobSchedulerException(com.thinkbiganalytics.scheduler.JobSchedulerException) ServiceLevelAgreement(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement) JcrServiceLevelAgreement(com.thinkbiganalytics.metadata.modeshape.sla.JcrServiceLevelAgreement) QuartzScheduler(com.thinkbiganalytics.scheduler.QuartzScheduler) JobIdentifier(com.thinkbiganalytics.scheduler.JobIdentifier) DefaultJobIdentifier(com.thinkbiganalytics.scheduler.model.DefaultJobIdentifier)

Aggregations

QuartzScheduler (com.thinkbiganalytics.scheduler.QuartzScheduler)6 JobIdentifier (com.thinkbiganalytics.scheduler.JobIdentifier)5 DefaultJobIdentifier (com.thinkbiganalytics.scheduler.model.DefaultJobIdentifier)5 JobSchedulerException (com.thinkbiganalytics.scheduler.JobSchedulerException)4 JcrServiceLevelAgreement (com.thinkbiganalytics.metadata.modeshape.sla.JcrServiceLevelAgreement)3 ServiceLevelAgreement (com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement)3 TriggerIdentifier (com.thinkbiganalytics.scheduler.TriggerIdentifier)2 DefaultTriggerIdentifier (com.thinkbiganalytics.scheduler.model.DefaultTriggerIdentifier)2 SchedulerException (org.quartz.SchedulerException)2 HashMap (java.util.HashMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ObjectAlreadyExistsException (org.quartz.ObjectAlreadyExistsException)1