Search in sources :

Example 1 with JobStatisticException

use of com.dangdang.ddframe.job.exception.JobStatisticException in project elastic-job by dangdangdotcom.

the class StatisticsScheduler method register.

/**
     * 注册统计作业.
     * 
     * @param statisticJob 统计作业
     */
void register(final StatisticJob statisticJob) {
    try {
        JobDetail jobDetail = statisticJob.buildJobDetail();
        Map<String, Object> dataMap = statisticJob.getDataMap();
        for (String each : dataMap.keySet()) {
            jobDetail.getJobDataMap().put(each, dataMap.get(each));
        }
        scheduler.scheduleJob(jobDetail, statisticJob.buildTrigger());
    } catch (final SchedulerException ex) {
        throw new JobStatisticException(ex);
    }
}
Also used : JobDetail(org.quartz.JobDetail) SchedulerException(org.quartz.SchedulerException) JobStatisticException(com.dangdang.ddframe.job.exception.JobStatisticException)

Example 2 with JobStatisticException

use of com.dangdang.ddframe.job.exception.JobStatisticException in project elastic-job by dangdangdotcom.

the class StatisticsScheduler method start.

/**
     * 启动调度器.
     */
void start() {
    try {
        scheduler = factory.getScheduler();
        scheduler.start();
    } catch (final SchedulerException ex) {
        throw new JobStatisticException(ex);
    }
}
Also used : SchedulerException(org.quartz.SchedulerException) JobStatisticException(com.dangdang.ddframe.job.exception.JobStatisticException)

Aggregations

JobStatisticException (com.dangdang.ddframe.job.exception.JobStatisticException)2 SchedulerException (org.quartz.SchedulerException)2 JobDetail (org.quartz.JobDetail)1