From 5ea7b5813412aad95e6b9ef73fe160468e0a5d7e Mon Sep 17 00:00:00 2001 From: "xueli.xue" Date: Fri, 24 Feb 2017 20:50:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0RM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xxl/job/core/executor/jetty/XxlJobExecutor.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/xxl-job-core/src/main/java/com/xxl/job/core/executor/jetty/XxlJobExecutor.java b/xxl-job-core/src/main/java/com/xxl/job/core/executor/jetty/XxlJobExecutor.java index 83014adc..c46cbf5c 100644 --- a/xxl-job-core/src/main/java/com/xxl/job/core/executor/jetty/XxlJobExecutor.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/executor/jetty/XxlJobExecutor.java @@ -16,6 +16,9 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; +import org.springframework.context.ApplicationEvent; +import org.springframework.context.ApplicationListener; +import org.springframework.context.event.ContextClosedEvent; import java.util.Map; import java.util.concurrent.TimeUnit; @@ -23,7 +26,7 @@ import java.util.concurrent.TimeUnit; /** * Created by xuxueli on 2016/3/2 21:14. */ -public class XxlJobExecutor implements ApplicationContextAware { +public class XxlJobExecutor implements ApplicationContextAware, ApplicationListener { private static final Logger logger = LoggerFactory.getLogger(XxlJobExecutor.class); private String ip; @@ -144,4 +147,12 @@ public class XxlJobExecutor implements ApplicationContextAware { } } + // ---------------------------------- destory job executor ------------------------------------ + @Override + public void onApplicationEvent(ApplicationEvent applicationEvent) { + if(applicationEvent instanceof ContextClosedEvent){ + // TODO + } + } + }