7
votes

I have the Quartz scheduler with Spring as part of my application, which is deployed in a clustered environment. The problem is that Quartz keeps firing a lot of queries (hundreds per minute) even though my jobs are scheduled to run once per hour (the jobs are triggered correctly). Is there a way to avoid/delay these Quartz queries?

EDIT: adding some queries fired by 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
Can you be more specific? What sort of queries are these?Nick Patsaris

1 Answers

4
votes

I think you're looking for org.quartz.scheduler.idleWaitTime, which defaults to hitting the database every 30 seconds to look for new queries when the schedule has nothing better to do. (Documentation link)