From 74c735bcdc6b89a2d388bd24ee3fe945128c11b5 Mon Sep 17 00:00:00 2001 From: xuxueli <931591021@qq.com> Date: Thu, 12 Dec 2019 12:09:34 +0800 Subject: [PATCH] update document --- .../sample/nutz/config/NutzSetup.java | 22 ++++++++----------- .../nutz/jobhandler/CommandJobHandler.java | 4 ---- .../nutz/jobhandler/DemoJobHandler.java | 4 ---- .../nutz/jobhandler/HttpJobHandler.java | 4 ---- .../nutz/jobhandler/ShardingJobHandler.java | 5 ----- 5 files changed, 9 insertions(+), 30 deletions(-) diff --git a/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/config/NutzSetup.java b/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/config/NutzSetup.java index eb370ee2..00770657 100644 --- a/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/config/NutzSetup.java +++ b/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/config/NutzSetup.java @@ -1,8 +1,10 @@ package com.xuxueli.executor.sample.nutz.config; +import com.xuxueli.executor.sample.nutz.jobhandler.CommandJobHandler; +import com.xuxueli.executor.sample.nutz.jobhandler.DemoJobHandler; +import com.xuxueli.executor.sample.nutz.jobhandler.HttpJobHandler; +import com.xuxueli.executor.sample.nutz.jobhandler.ShardingJobHandler; import com.xxl.job.core.executor.XxlJobExecutor; -import com.xxl.job.core.handler.IJobHandler; -import com.xxl.job.core.handler.annotation.JobHandler; import org.nutz.ioc.impl.PropertiesProxy; import org.nutz.mvc.NutConfig; import org.nutz.mvc.Setup; @@ -16,23 +18,17 @@ import org.slf4j.LoggerFactory; */ public class NutzSetup implements Setup { private Logger logger = LoggerFactory.getLogger(NutzSetup.class); - //public static final Log logger = Logs.get(); private XxlJobExecutor xxlJobExecutor = null; @Override public void init(NutConfig cfg) { - // regist JobHandler - String[] beanNames = cfg.getIoc().getNamesByType(IJobHandler.class); - if (beanNames==null || beanNames.length==0) { - return; - } - for (String beanName : beanNames) { - IJobHandler jobHandler = cfg.getIoc().get(IJobHandler.class, beanName); - String name = jobHandler.getClass().getAnnotation(JobHandler.class).value(); - XxlJobExecutor.registJobHandler(name, jobHandler); - } + // registry jobhandler + XxlJobExecutor.registJobHandler("demoJobHandler", new DemoJobHandler()); + XxlJobExecutor.registJobHandler("shardingJobHandler", new ShardingJobHandler()); + XxlJobExecutor.registJobHandler("httpJobHandler", new HttpJobHandler()); + XxlJobExecutor.registJobHandler("commandJobHandler", new CommandJobHandler()); // load executor prop PropertiesProxy xxlJobProp = new PropertiesProxy("xxl-job-executor.properties"); diff --git a/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/jobhandler/CommandJobHandler.java b/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/jobhandler/CommandJobHandler.java index adbebcf2..120180aa 100644 --- a/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/jobhandler/CommandJobHandler.java +++ b/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/jobhandler/CommandJobHandler.java @@ -2,9 +2,7 @@ package com.xuxueli.executor.sample.nutz.jobhandler; import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.handler.IJobHandler; -import com.xxl.job.core.handler.annotation.JobHandler; import com.xxl.job.core.log.XxlJobLogger; -import org.nutz.ioc.loader.annotation.IocBean; import java.io.BufferedInputStream; import java.io.BufferedReader; @@ -15,8 +13,6 @@ import java.io.InputStreamReader; * * @author xuxueli 2018-09-16 03:48:34 */ -@JobHandler(value="commandJobHandler") -@IocBean public class CommandJobHandler extends IJobHandler { @Override diff --git a/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/jobhandler/DemoJobHandler.java b/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/jobhandler/DemoJobHandler.java index 20f1b3ba..420c0030 100644 --- a/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/jobhandler/DemoJobHandler.java +++ b/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/jobhandler/DemoJobHandler.java @@ -2,9 +2,7 @@ package com.xuxueli.executor.sample.nutz.jobhandler; import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.handler.IJobHandler; -import com.xxl.job.core.handler.annotation.JobHandler; import com.xxl.job.core.log.XxlJobLogger; -import org.nutz.ioc.loader.annotation.IocBean; import java.util.concurrent.TimeUnit; @@ -19,8 +17,6 @@ import java.util.concurrent.TimeUnit; * * @author xuxueli 2015-12-19 19:43:36 */ -@JobHandler(value="demoJobHandler") -@IocBean public class DemoJobHandler extends IJobHandler { @Override diff --git a/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/jobhandler/HttpJobHandler.java b/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/jobhandler/HttpJobHandler.java index 5d2724ec..895afccc 100644 --- a/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/jobhandler/HttpJobHandler.java +++ b/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/jobhandler/HttpJobHandler.java @@ -2,9 +2,7 @@ package com.xuxueli.executor.sample.nutz.jobhandler; import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.handler.IJobHandler; -import com.xxl.job.core.handler.annotation.JobHandler; import com.xxl.job.core.log.XxlJobLogger; -import org.nutz.ioc.loader.annotation.IocBean; import java.io.BufferedReader; import java.io.InputStreamReader; @@ -16,8 +14,6 @@ import java.net.URL; * * @author xuxueli 2018-09-16 03:48:34 */ -@JobHandler(value = "httpJobHandler") -@IocBean public class HttpJobHandler extends IJobHandler { @Override diff --git a/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/jobhandler/ShardingJobHandler.java b/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/jobhandler/ShardingJobHandler.java index 9681bf1a..d01ab918 100644 --- a/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/jobhandler/ShardingJobHandler.java +++ b/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/jobhandler/ShardingJobHandler.java @@ -1,8 +1,5 @@ package com.xuxueli.executor.sample.nutz.jobhandler; -import com.xxl.job.core.handler.annotation.JobHandler; -import org.nutz.ioc.loader.annotation.IocBean; - import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.handler.IJobHandler; import com.xxl.job.core.log.XxlJobLogger; @@ -13,8 +10,6 @@ import com.xxl.job.core.util.ShardingUtil; * * @author xuxueli 2017-07-25 20:56:50 */ -@JobHandler(value="shardingJobHandler") -@IocBean public class ShardingJobHandler extends IJobHandler { @Override