带有jdbc:**作业的Quartz调度程序未保存在数据库中**

时间:2016-08-17 13:59:02

标签: java jdbc quartz-scheduler

我使用JDBC作业存储技术来保存作业。

My quartz.properties file is here

    ==========================================
     Configure Main Scheduler Properties  
    ===========================================

    org.quartz.scheduler.instanceName = ScheduleReport 
    //its having a method scheduler.scheduleJob(jobDetail, simpleTrigger); 

    org.quartz.scheduler.instanceId = AUTO

    ============================================
     Configure ThreadPool  
    ============================================

    org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
    org.quartz.threadPool.threadCount = 25
    org.quartz.threadPool.threadPriority = 5

    ============================================
     Configure JobStore  
    =============================================

    org.quartz.jobStore.misfireThreshold = 60000

    org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
    org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
    org.quartz.jobStore.useProperties = true
    org.quartz.jobStore.tablePrefix = QRTZ_

    org.quartz.jobStore.isClustered = true
    org.quartz.jobStore.clusterCheckinInterval = 20000

    org.quartz.jobStore.dataSource = qzDS
    org.quartz.dataSource.qzDS.driver = oracle.jdbc.driver.OracleDriver
    org.quartz.dataSource.qzDS.URL = jdbc:oracle:thin:@localhost:1521:abc
    org.quartz.dataSource.qzDS.user = system
    org.quartz.dataSource.qzDS.password = abc
    org.quartz.dataSource.qzDS.maxConnections = 30

Java文件实现了作业:

public class ScheduleReport implements Job {
    public void execute(JobExecutionContext context) throws JobExecutionException {
        JobDataMap dataMap = context.getJobDetail().getJobDataMap();
        exportReportAsType();
    }
}

另一个带有计划作业的java文件:

JobDetail jobweek = JobBuilder.newJob(ScheduleReport.class)
                        .withIdentity(jobname+"_"+jobid, "week").build();
jobweek.getJobDataMap().put("reportid", reportid);
jobweek.getJobDataMap().put("jobid", jobid);
jobweek.getJobDataMap().put("reportname", reportname);
jobweek.getJobDataMap().put("dateTime", dateTime);
jobweek.getJobDataMap().put("dateTimeType", sdf1.parse(dateTime));

jobweek.getJobDataMap().put("schedulerService",
        schedulerService);

CronTrigger trigger3 = TriggerBuilder
        .newTrigger()
        .withIdentity(jobname+"_"+jobid, "week")
        .startAt(sdf1.parse(dateTime))
        .withSchedule(CronScheduleBuilder.cronSchedule(weekSch))
        .endAt(sdf1.parse(enddateTime)).build();
// scheduler.start();
scheduler.scheduleJob(jobweek, trigger3);

这是我的配置,但我无法在DB中存储作业。当我在db QRTZ_LOCKS&中看到该表时QRTZ_SCHEDULER_STATE仅包含数据,其他表格为空白。

0 个答案:

没有答案