quartz-redis-jobstore icon indicating copy to clipboard operation
quartz-redis-jobstore copied to clipboard

Suppress error log on ObjectAlreadyExistsException

Open konieshadow opened this issue 5 years ago • 0 comments

When schedule some job, I want to catch the ObjectAlreadyExistsException to determine whether exists a same job and then reschedule it. This works fine but the log output from RedisStorage is annoying. Like this:

2019-05-22 16:42:47.475  INFO 9064 --- [           main] n.joelinn.quartz.jobstore.RedisJobStore  : Job and / or trigger already exist in storage.

org.quartz.ObjectAlreadyExistsException: Unable to store Job : 'com.handarui.novel.server.biz.task.IndexUpdateNovelJob.indexUpdateNovel', because one already exists with this identification.
	at net.joelinn.quartz.jobstore.RedisStorage.storeJob(RedisStorage.java:167)
	at net.joelinn.quartz.jobstore.RedisStorage.storeJob(RedisStorage.java:26)
	at net.joelinn.quartz.jobstore.RedisJobStore$1.doWithLock(RedisJobStore.java:263)
	at net.joelinn.quartz.jobstore.RedisJobStore$1.doWithLock(RedisJobStore.java:260)
	at net.joelinn.quartz.jobstore.RedisJobStore.doWithLock(RedisJobStore.java:1154)
	at net.joelinn.quartz.jobstore.RedisJobStore.doWithLock(RedisJobStore.java:1136)
	at net.joelinn.quartz.jobstore.RedisJobStore.storeJobAndTrigger(RedisJobStore.java:260)
	at org.quartz.core.QuartzScheduler.scheduleJob(QuartzScheduler.java:886)
	at org.quartz.impl.StdScheduler.scheduleJob(StdScheduler.java:249)
	at com.handarui.novel.server.biz.task.QuartzStartRunner.startIndexUpdateNovelJob(QuartzStartRunner.kt:132)
	at com.handarui.novel.server.biz.task.QuartzStartRunner.run(QuartzStartRunner.kt:29)
	at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:732)
	at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:716)
	at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:703)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:304)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
	at com.handarui.novel.server.Main.main(Main.java:22)

I wunder if it can be suppressed and just let user to handle the exception.

konieshadow avatar May 22 '19 09:05 konieshadow