From 1b90a9ca5281d1bcca8c5d6fb24e566ace9fcf3c Mon Sep 17 00:00:00 2001 From: "773899172@qq.com" Date: Mon, 12 Nov 2018 00:39:08 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E7=94=A8destroy=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=EF=BC=8CjobHandlerRepository?= =?UTF-8?q?=E4=B9=9F=E8=A6=81=E6=B8=85=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xxl/job/core/executor/XxlJobExecutor.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java b/xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java index 81677753..b2eceb30 100644 --- a/xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java @@ -91,6 +91,12 @@ public class XxlJobExecutor { } jobThreadRepository.clear(); } + if(jobHandlerRepository.size() >0 ){ + for (Map.Entry item: jobHandlerRepository.entrySet()){ + removeJobHandler(item.getKey(), "web container destroy and kill the jod handler"); + } + jobHandlerRepository.clear(); + } // destory JobLogFileCleanThread @@ -103,6 +109,13 @@ public class XxlJobExecutor { stopRpcProvider(); } + private void removeJobHandler(String handlerId, String removeOldReason){ + IJobHandler oldJobHandler = jobHandlerRepository.remove(handlerId); + if (oldJobHandler != null) { + oldJobHandler.destroy(); + } + } + // ---------------------- admin-client (rpc invoker) ---------------------- private static List adminBizList;