Example usage for org.springframework.scheduling SchedulingException SchedulingException

List of usage examples for org.springframework.scheduling SchedulingException SchedulingException

Introduction

In this page you can find the example usage for org.springframework.scheduling SchedulingException SchedulingException.

Prototype

public SchedulingException(String msg, Throwable cause) 

Source Link

Document

Constructor for SchedulingException.

Usage

From source file:com.gybas.evaluation.quartz.setup.WaitingSchedulerFactoryBean.java

/**
 * {@inheritDoc}/*from  w  ww . j  a v  a2 s . c om*/
 */
@Override
public void stop() {
    try {
        super.destroy();
    } catch (SchedulerException e) {
        throw new SchedulingException("Could not destroy scheduler", e);
    }
}

From source file:com.mtgi.analytics.aop.config.v11.SchedulerActivationPostProcessor.java

public void afterPropertiesSet() throws Exception {
    Scheduler scheduler = (Scheduler) sourceFactory.getBean(schedulerName, Scheduler.class);
    Trigger trigger = (Trigger) sourceFactory.getBean(triggerName, Trigger.class);
    try {//from   w  w  w .  j  a  v  a 2  s. com
        if (trigger instanceof JobDetailAwareTrigger) {
            JobDetail job = ((JobDetailAwareTrigger) trigger).getJobDetail();
            scheduler.addJob(job, false);
        }
        scheduler.scheduleJob(trigger);
    } catch (SchedulerException e) {
        throw new SchedulingException("error scheduling trigger [" + trigger + "]", e);
    }
}

From source file:com.saysth.commons.quartz.SchedulerFactoryBean.java

/**
 * Start the Quartz Scheduler, respecting the "startupDelay" setting.
 * /*from   www  .  ja v a 2  s .co m*/
 * @param scheduler
 *            the Scheduler to start
 * @param startupDelay
 *            the number of seconds to wait before starting the Scheduler
 *            asynchronously
 */
protected void startScheduler(final Scheduler scheduler, final int startupDelay) throws SchedulerException {
    if (startupDelay <= 0) {
        logger.info("Starting Quartz Scheduler now");
        scheduler.start();
    } else {
        if (logger.isInfoEnabled()) {
            logger.info("Will start Quartz Scheduler [" + scheduler.getSchedulerName() + "] in " + startupDelay
                    + " seconds");
        }
        Thread schedulerThread = new Thread() {
            @Override
            public void run() {
                try {
                    Thread.sleep(startupDelay * 1000);
                } catch (InterruptedException ex) {
                    // simply proceed
                }
                if (logger.isInfoEnabled()) {
                    logger.info("Starting Quartz Scheduler now, after delay of " + startupDelay + " seconds");
                }
                try {
                    scheduler.start();
                } catch (SchedulerException ex) {
                    throw new SchedulingException("Could not start Quartz Scheduler after delay", ex);
                }
            }
        };
        schedulerThread.setName("Quartz Scheduler [" + scheduler.getSchedulerName() + "]");
        schedulerThread.setDaemon(true);
        schedulerThread.start();
    }
}

From source file:com.saysth.commons.quartz.SchedulerFactoryBean.java

public void start() throws SchedulingException {
    if (this.scheduler != null) {
        try {/* w w  w  . j  av a 2s .  c  o m*/
            startScheduler(this.scheduler, this.startupDelay);
        } catch (SchedulerException ex) {
            throw new SchedulingException("Could not start Quartz Scheduler", ex);
        }
    }
}

From source file:com.saysth.commons.quartz.SchedulerFactoryBean.java

public void stop() throws SchedulingException {
    if (this.scheduler != null) {
        try {//from w  w w. jav  a 2s .  c  o  m
            this.scheduler.standby();
        } catch (SchedulerException ex) {
            throw new SchedulingException("Could not stop Quartz Scheduler", ex);
        }
    }
}