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 a56c6feb2abb..fd961cde1784 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 void deleteSchedule(int projectId, int scheduleId) { 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); } /**