From 2bd5127b1466790775a9606d4c8a0a2f2aa0ab33 Mon Sep 17 00:00:00 2001 From: wankaiyi Date: Fri, 27 Dec 2024 14:20:02 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=90=E5=88=B6=E5=AD=90=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E6=98=AF=E4=BB=BB=E5=8A=A1=E6=9C=AC=E8=BA=AB?= =?UTF-8?q?=EF=BC=8C=E9=98=B2=E6=AD=A2=E9=80=92=E5=BD=92=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E5=92=8C=E6=AD=BB=E5=BE=AA=E7=8E=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xxl/job/admin/core/complete/XxlJobCompleter.java | 4 ++++ .../com/xxl/job/admin/service/impl/XxlJobServiceImpl.java | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/complete/XxlJobCompleter.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/complete/XxlJobCompleter.java index 279ad7d16d..b390bcbf61 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/complete/XxlJobCompleter.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/complete/XxlJobCompleter.java @@ -55,6 +55,10 @@ private static void finishJob(XxlJobLog xxlJobLog){ String[] childJobIds = xxlJobInfo.getChildJobId().split(","); for (int i = 0; i < childJobIds.length; i++) { int childJobId = (childJobIds[i]!=null && childJobIds[i].trim().length()>0 && isNumeric(childJobIds[i]))?Integer.valueOf(childJobIds[i]):-1; + if (childJobId == xxlJobLog.getJobId()) { + logger.info("jobid {} is self, ignore it.", childJobId); + continue; + } if (childJobId > 0) { JobTriggerPoolHelper.trigger(childJobId, TriggerTypeEnum.PARENT, -1, null, null, null); diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java index 2c1a0ac820..0c02b7a9c0 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java @@ -222,7 +222,11 @@ public ReturnT update(XxlJobInfo jobInfo, XxlJobUser loginUser) { String[] childJobIds = jobInfo.getChildJobId().split(","); for (String childJobIdItem: childJobIds) { if (childJobIdItem!=null && childJobIdItem.trim().length()>0 && isNumeric(childJobIdItem)) { - XxlJobInfo childJobInfo = xxlJobInfoDao.loadById(Integer.parseInt(childJobIdItem)); + int childJobId = Integer.parseInt(childJobIdItem); + XxlJobInfo childJobInfo = xxlJobInfoDao.loadById(childJobId); + if (childJobId == jobInfo.getId()) { + return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_childJobId")+"("+childJobId+")"+I18nUtil.getString("system_unvalid")) ); + } if (childJobInfo==null) { return new ReturnT(ReturnT.FAIL_CODE, MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId")+"({0})"+I18nUtil.getString("system_not_found")), childJobIdItem));