Bläddra i källkod

update document

xuxueli 5 år sedan
förälder
incheckning
74c735bcdc

+ 9 - 13
xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/config/NutzSetup.java Visa fil

@@ -1,8 +1,10 @@
1 1
 package com.xuxueli.executor.sample.nutz.config;
2 2
 
3
+import com.xuxueli.executor.sample.nutz.jobhandler.CommandJobHandler;
4
+import com.xuxueli.executor.sample.nutz.jobhandler.DemoJobHandler;
5
+import com.xuxueli.executor.sample.nutz.jobhandler.HttpJobHandler;
6
+import com.xuxueli.executor.sample.nutz.jobhandler.ShardingJobHandler;
3 7
 import com.xxl.job.core.executor.XxlJobExecutor;
4
-import com.xxl.job.core.handler.IJobHandler;
5
-import com.xxl.job.core.handler.annotation.JobHandler;
6 8
 import org.nutz.ioc.impl.PropertiesProxy;
7 9
 import org.nutz.mvc.NutConfig;
8 10
 import org.nutz.mvc.Setup;
@@ -16,23 +18,17 @@ import org.slf4j.LoggerFactory;
16 18
  */
17 19
 public class NutzSetup implements Setup {
18 20
 	private Logger logger = LoggerFactory.getLogger(NutzSetup.class);
19
-	//public static final Log logger = Logs.get();
20 21
 
21 22
 	private XxlJobExecutor xxlJobExecutor = null;
22 23
 
23 24
 	@Override
24 25
 	public void init(NutConfig cfg) {
25 26
 
26
-		// regist JobHandler
27
-		String[] beanNames = cfg.getIoc().getNamesByType(IJobHandler.class);
28
-		if (beanNames==null || beanNames.length==0) {
29
-			return;
30
-		}
31
-		for (String beanName : beanNames) {
32
-			IJobHandler jobHandler = cfg.getIoc().get(IJobHandler.class, beanName);
33
-			String name = jobHandler.getClass().getAnnotation(JobHandler.class).value();
34
-			XxlJobExecutor.registJobHandler(name, jobHandler);
35
-		}
27
+		// registry jobhandler
28
+		XxlJobExecutor.registJobHandler("demoJobHandler", new DemoJobHandler());
29
+		XxlJobExecutor.registJobHandler("shardingJobHandler", new ShardingJobHandler());
30
+		XxlJobExecutor.registJobHandler("httpJobHandler", new HttpJobHandler());
31
+		XxlJobExecutor.registJobHandler("commandJobHandler", new CommandJobHandler());
36 32
 
37 33
 		// load executor prop
38 34
 		PropertiesProxy xxlJobProp = new PropertiesProxy("xxl-job-executor.properties");

+ 0 - 4
xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/jobhandler/CommandJobHandler.java Visa fil

@@ -2,9 +2,7 @@ package com.xuxueli.executor.sample.nutz.jobhandler;
2 2
 
3 3
 import com.xxl.job.core.biz.model.ReturnT;
4 4
 import com.xxl.job.core.handler.IJobHandler;
5
-import com.xxl.job.core.handler.annotation.JobHandler;
6 5
 import com.xxl.job.core.log.XxlJobLogger;
7
-import org.nutz.ioc.loader.annotation.IocBean;
8 6
 
9 7
 import java.io.BufferedInputStream;
10 8
 import java.io.BufferedReader;
@@ -15,8 +13,6 @@ import java.io.InputStreamReader;
15 13
  *
16 14
  * @author xuxueli 2018-09-16 03:48:34
17 15
  */
18
-@JobHandler(value="commandJobHandler")
19
-@IocBean
20 16
 public class CommandJobHandler extends IJobHandler {
21 17
 
22 18
     @Override

+ 0 - 4
xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/jobhandler/DemoJobHandler.java Visa fil

@@ -2,9 +2,7 @@ package com.xuxueli.executor.sample.nutz.jobhandler;
2 2
 
3 3
 import com.xxl.job.core.biz.model.ReturnT;
4 4
 import com.xxl.job.core.handler.IJobHandler;
5
-import com.xxl.job.core.handler.annotation.JobHandler;
6 5
 import com.xxl.job.core.log.XxlJobLogger;
7
-import org.nutz.ioc.loader.annotation.IocBean;
8 6
 
9 7
 import java.util.concurrent.TimeUnit;
10 8
 
@@ -19,8 +17,6 @@ import java.util.concurrent.TimeUnit;
19 17
  *
20 18
  * @author xuxueli 2015-12-19 19:43:36
21 19
  */
22
-@JobHandler(value="demoJobHandler")
23
-@IocBean
24 20
 public class DemoJobHandler extends IJobHandler {
25 21
 
26 22
 	@Override

+ 0 - 4
xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/jobhandler/HttpJobHandler.java Visa fil

@@ -2,9 +2,7 @@ package com.xuxueli.executor.sample.nutz.jobhandler;
2 2
 
3 3
 import com.xxl.job.core.biz.model.ReturnT;
4 4
 import com.xxl.job.core.handler.IJobHandler;
5
-import com.xxl.job.core.handler.annotation.JobHandler;
6 5
 import com.xxl.job.core.log.XxlJobLogger;
7
-import org.nutz.ioc.loader.annotation.IocBean;
8 6
 
9 7
 import java.io.BufferedReader;
10 8
 import java.io.InputStreamReader;
@@ -16,8 +14,6 @@ import java.net.URL;
16 14
  *
17 15
  * @author xuxueli 2018-09-16 03:48:34
18 16
  */
19
-@JobHandler(value = "httpJobHandler")
20
-@IocBean
21 17
 public class HttpJobHandler extends IJobHandler {
22 18
 
23 19
     @Override

+ 0 - 5
xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/jobhandler/ShardingJobHandler.java Visa fil

@@ -1,8 +1,5 @@
1 1
 package com.xuxueli.executor.sample.nutz.jobhandler;
2 2
 
3
-import com.xxl.job.core.handler.annotation.JobHandler;
4
-import org.nutz.ioc.loader.annotation.IocBean;
5
-
6 3
 import com.xxl.job.core.biz.model.ReturnT;
7 4
 import com.xxl.job.core.handler.IJobHandler;
8 5
 import com.xxl.job.core.log.XxlJobLogger;
@@ -13,8 +10,6 @@ import com.xxl.job.core.util.ShardingUtil;
13 10
  *
14 11
  * @author xuxueli 2017-07-25 20:56:50
15 12
  */
16
-@JobHandler(value="shardingJobHandler")
17
-@IocBean
18 13
 public class ShardingJobHandler extends IJobHandler {
19 14
 
20 15
 	@Override