You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by ji...@apache.org on 2022/07/01 08:55:38 UTC

[dolphinscheduler] branch 2.0.6-prepare updated: to #9801: fix delete job of quartz not work (#10645)

This is an automated email from the ASF dual-hosted git repository.

jinyleechina pushed a commit to branch 2.0.6-prepare
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/2.0.6-prepare by this push:
     new 85d3637f9d to #9801: fix delete job of quartz not work (#10645)
85d3637f9d is described below

commit 85d3637f9d659a0e9d6fb73922753ed2d9c45998
Author: zwZjut <zw...@163.com>
AuthorDate: Fri Jul 1 16:55:30 2022 +0800

    to #9801: fix delete job of quartz not work (#10645)
    
    Co-authored-by: 宏豁 <ho...@alibaba-inc.com>
---
 .../api/service/impl/SchedulerServiceImpl.java             | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java
index a56c6feb2a..fd961cde17 100644
--- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java
+++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java
@@ -459,17 +459,11 @@ public class SchedulerServiceImpl extends BaseServiceImpl implements SchedulerSe
 
         String jobName = QuartzExecutors.buildJobName(scheduleId);
         String jobGroupName = QuartzExecutors.buildJobGroupName(projectId);
-
-        JobKey jobKey = new JobKey(jobName, jobGroupName);
-        try {
-            if (scheduler.checkExists(jobKey)) {
-                logger.info("Try to delete job: {}, group name: {},", jobName, jobGroupName);
-                scheduler.deleteJob(jobKey);
-            }
-        } catch (SchedulerException e) {
-            logger.error("Failed to delete job: {}", jobKey);
-            throw new ServiceException("Failed to delete job: " + jobKey);
+        boolean result = QuartzExecutors.getInstance().deleteJob(jobName, jobGroupName);
+        if (!result) {
+            throw new ServiceException(String.format("Failed to delete job, jobName:%s, jobGroupName:%s", jobName, jobGroupName));
         }
+        logger.info("delete job success, job name: {}, job group name: {},", jobName, jobGroupName);
     }
 
     /**