From ee5b0fdc76c5b2527d943fe7adfba35d4bbee7fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E9=B9=8F?= <1110@forex.com.cn> Date: Tue, 9 Oct 2018 10:44:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=8B=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xxl/job/core/executor/XxlJobExecutor.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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 f25502b3..74734728 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 @@ -88,12 +88,12 @@ public class XxlJobExecutor implements ApplicationContextAware { JobLogFileCleanThread.getInstance().start(logRetentionDays); } public void destroy(){ - // destory JobThreadRepository - if (JobThreadRepository.size() > 0) { - for (Map.Entry item: JobThreadRepository.entrySet()) { + // destory jobThreadRepository + if (jobThreadRepository.size() > 0) { + for (Map.Entry item: jobThreadRepository.entrySet()) { removeJobThread(item.getKey(), "web container destroy and kill the job."); } - JobThreadRepository.clear(); + jobThreadRepository.clear(); } // destory executor-server @@ -174,13 +174,13 @@ public class XxlJobExecutor implements ApplicationContextAware { // ---------------------- job thread repository ---------------------- - private static ConcurrentHashMap JobThreadRepository = new ConcurrentHashMap(); + private static ConcurrentHashMap jobThreadRepository = new ConcurrentHashMap(); public static JobThread registJobThread(int jobId, IJobHandler handler, String removeOldReason){ JobThread newJobThread = new JobThread(jobId, handler); newJobThread.start(); logger.info(">>>>>>>>>>> xxl-job regist JobThread success, jobId:{}, handler:{}", new Object[]{jobId, handler}); - JobThread oldJobThread = JobThreadRepository.put(jobId, newJobThread); // putIfAbsent | oh my god, map's put method return the old value!!! + JobThread oldJobThread = jobThreadRepository.put(jobId, newJobThread); // putIfAbsent | oh my god, map's put method return the old value!!! if (oldJobThread != null) { oldJobThread.toStop(removeOldReason); oldJobThread.interrupt(); @@ -189,14 +189,14 @@ public class XxlJobExecutor implements ApplicationContextAware { return newJobThread; } public static void removeJobThread(int jobId, String removeOldReason){ - JobThread oldJobThread = JobThreadRepository.remove(jobId); + JobThread oldJobThread = jobThreadRepository.remove(jobId); if (oldJobThread != null) { oldJobThread.toStop(removeOldReason); oldJobThread.interrupt(); } } public static JobThread loadJobThread(int jobId){ - JobThread jobThread = JobThreadRepository.get(jobId); + JobThread jobThread = jobThreadRepository.get(jobId); return jobThread; }