如何限制quartz-scheduler触发的查询

时间:2013-05-22 08:43:34

标签: java quartz-scheduler

我将Quartz调度程序与Spring作为我的应用程序的一部分,它部署在集群环境中。问题是,即使我的作业计划每小时运行一次(正确触发作业),Quartz也会持续发出大量查询(每分钟数百个)。有没有办法避免/延迟这些Quartz查询?

编辑:添加一些Quartz

触发的查询
UPDATE QRTZ_TRIGGERS SET TRIGGER_STATE = 'ACQUIRED' WHERE SCHED_NAME = 'SW_QUARTZ_SCHEDULER' AND TRIGGER_NAME = 'createCronTriggerFactoryBeanForPSDJob' AND TRIGGER_GROUP = 'SPRING3-QUARTZ' AND TRIGGER_STATE = 'WAITING'

INSERT INTO QRTZ_FIRED_TRIGGERS (SCHED_NAME, ENTRY_ID, TRIGGER_NAME, TRIGGER_GROUP, INSTANCE_NAME, FIRED_TIME, STATE, JOB_NAME, JOB_GROUP, IS_NONCONCURRENT, REQUESTS_RECOVERY, PRIORITY) VALUES('SW_QUARTZ_SCHEDULER', 'sw-jayz-5413692078375651369207837517', 'createCronTriggerFactoryBeanForPSDJob', 'SPRING3-QUARTZ', 'sw-jayz-541369207837565', 1369207800000, 'ACQUIRED', NULL, NULL, 0, 0, 0)

SELECT * FROM QRTZ_JOB_DETAILS WHERE SCHED_NAME = 'SW_QUARTZ_SCHEDULER' AND JOB_NAME = 'createJobDetailFactoryBeanForPSDJob' AND JOB_GROUP = 'SPRING3-QUARTZ
DELETE FROM QRTZ_SIMPLE_TRIGGERS WHERE SCHED_NAME = 'SW_QUARTZ_SCHEDULER' AND TRIGGER_NAME = 'createCronTriggerFactoryBeanForQMRJob' AND TRIGGER_GROUP = 'SPRING3-QUARTZ'

1 个答案:

答案 0 :(得分:3)

我认为您正在寻找org.quartz.scheduler.idleWaitTime,默认情况下,每30秒就会访问一次数据库,以便在计划没有更好的办法时查找新的查询。 (Documentation link