From f31d0c8498cd6eefb737a87b7aeca94488df7cf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=8A=B9=EC=A7=84?= Date: Sun, 10 Nov 2024 15:17:36 +0900 Subject: [PATCH] Handle exceptions thrown while retrieving the misfired trigger MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 김승진 --- .../impl/jdbcjobstore/JobStoreSupport.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/quartz/src/main/java/org/quartz/impl/jdbcjobstore/JobStoreSupport.java b/quartz/src/main/java/org/quartz/impl/jdbcjobstore/JobStoreSupport.java index 4ac80443e..53c9e4f67 100644 --- a/quartz/src/main/java/org/quartz/impl/jdbcjobstore/JobStoreSupport.java +++ b/quartz/src/main/java/org/quartz/impl/jdbcjobstore/JobStoreSupport.java @@ -966,16 +966,25 @@ conn, STATE_WAITING, getMisfireTime(), } for (TriggerKey triggerKey: misfiredTriggers) { - - OperableTrigger trig = - retrieveTrigger(conn, triggerKey); + OperableTrigger trig; - if (trig == null) { + try { + trig = retrieveTrigger(conn, triggerKey); + } catch (Exception e) { + getLog().error("Error retrieving the misfired trigger: {}", triggerKey, e); continue; } - doUpdateOfMisfiredTrigger(conn, trig, false, STATE_WAITING, recovering); + if (trig == null) { + continue; + } + try { + doUpdateOfMisfiredTrigger(conn, trig, false, STATE_WAITING, recovering); + } catch (Exception e) { + getLog().error("Error updating misfired trigger: {}", trig.getKey(), e); + continue; + } if(trig.getNextFireTime() != null && trig.getNextFireTime().getTime() < earliestNewTime) earliestNewTime = trig.getNextFireTime().getTime(); }