|
@@ -5,6 +5,8 @@ import com.xxl.job.core.glue.GlueFactory;
|
5
|
5
|
import com.xxl.job.core.handler.IJobHandler;
|
6
|
6
|
import com.xxl.job.core.handler.annotation.JobHandler;
|
7
|
7
|
import org.springframework.beans.BeansException;
|
|
8
|
+import org.springframework.beans.factory.DisposableBean;
|
|
9
|
+import org.springframework.beans.factory.InitializingBean;
|
8
|
10
|
import org.springframework.context.ApplicationContext;
|
9
|
11
|
import org.springframework.context.ApplicationContextAware;
|
10
|
12
|
|
|
@@ -15,11 +17,12 @@ import java.util.Map;
|
15
|
17
|
*
|
16
|
18
|
* @author xuxueli 2018-11-01 09:24:52
|
17
|
19
|
*/
|
18
|
|
-public class XxlJobSpringExecutor extends XxlJobExecutor implements ApplicationContextAware {
|
|
20
|
+public class XxlJobSpringExecutor extends XxlJobExecutor implements ApplicationContextAware, InitializingBean, DisposableBean {
|
19
|
21
|
|
20
|
22
|
|
|
23
|
+ // start
|
21
|
24
|
@Override
|
22
|
|
- public void start() throws Exception {
|
|
25
|
+ public void afterPropertiesSet() throws Exception {
|
23
|
26
|
|
24
|
27
|
// init JobHandler Repository
|
25
|
28
|
initJobHandlerRepository(applicationContext);
|
|
@@ -32,6 +35,13 @@ public class XxlJobSpringExecutor extends XxlJobExecutor implements ApplicationC
|
32
|
35
|
super.start();
|
33
|
36
|
}
|
34
|
37
|
|
|
38
|
+ // destroy
|
|
39
|
+ @Override
|
|
40
|
+ public void destroy() {
|
|
41
|
+ super.destroy();
|
|
42
|
+ }
|
|
43
|
+
|
|
44
|
+
|
35
|
45
|
private void initJobHandlerRepository(ApplicationContext applicationContext){
|
36
|
46
|
if (applicationContext == null) {
|
37
|
47
|
return;
|