Browse Source

新增Nutz执行器Sample示例项目;

xuxueli 7 years ago
parent
commit
06c72af187
24 changed files with 149 additions and 167 deletions
  1. 32 29
      doc/XXL-JOB官方文档.md
  2. 2 1
      xxl-job-executor-samples/xxl-job-executor-sample-jfinal/src/main/java/com/xuxueli/executor/sample/jfinal/config/JFinalCoreConfig.java
  3. 1 0
      xxl-job-executor-samples/xxl-job-executor-sample-jfinal/src/main/java/com/xuxueli/executor/sample/jfinal/controller/IndexController.java
  4. 4 5
      xxl-job-executor-samples/xxl-job-executor-sample-jfinal/src/main/java/com/xuxueli/executor/sample/jfinal/jobhandler/DemoJobHandler.java
  5. 1 1
      xxl-job-executor-samples/xxl-job-executor-sample-jfinal/src/main/resources/xxl-job-executor.properties
  6. 6 0
      xxl-job-executor-samples/xxl-job-executor-sample-jfinal/src/main/webapp/WEB-INF/web.xml
  7. 1 0
      xxl-job-executor-samples/xxl-job-executor-sample-jfinal/src/main/webapp/index.html
  8. 12 15
      xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/MainModule.java
  9. 27 18
      xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/MainSetup.java
  10. 12 10
      xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/jobhandler/DemoJobHandler.java
  11. 5 4
      xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/jobhandler/ShardingJobHandler.java
  12. 6 8
      xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/module/IndexModule.java
  13. 0 38
      xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/resources/ioc/dao.js
  14. 9 9
      xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/resources/log4j.xml
  15. 2 2
      xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/resources/custom/xxl-job-executor.properties
  16. 0 12
      xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/webapp/WEB-INF/index.jsp
  17. 13 3
      xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/webapp/WEB-INF/web.xml
  18. 0 0
      xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/webapp/index
  19. 1 0
      xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/webapp/index.html
  20. 4 4
      xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/java/com/xxl/job/executor/service/jobhandler/DemoJobHandler.java
  21. 5 2
      xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/webapp/WEB-INF/web.xml
  22. 1 1
      xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/webapp/index.html
  23. 4 4
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/service/jobhandler/DemoJobHandler.java
  24. 1 1
      xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/application.properties

+ 32 - 29
doc/XXL-JOB官方文档.md

@@ -386,9 +386,11 @@ XXL-JOB是一个轻量级分布式任务调度框架,其核心设计目标是
 任务逻辑以JobHandler的形式存在于“执行器”所在项目中,开发流程如下:
 
 #### 步骤一:执行器项目中,开发JobHandler:
-    - 1、 新建一个继承com.xxl.job.core.handler.IJobHandler的Java类;
-    - 2、 该类被Spring容器扫描为Bean实例,如加“@Component”注解;
-    - 3、 添加 “@JobHandler(value="自定义jobhandler名称")”注解,注解的value值为自定义的JobHandler名称,该名称对应的是调度中心新建任务的JobHandler属性的值。
+
+     - 1、继承"IJobHandler":“com.xxl.job.core.handler.IJobHandler”;
+     - 2、注册到Spring容器:添加“@Component”注解,被Spring容器扫描为Bean实例;
+     - 3、注册到执行器工厂:添加“@JobHandler(value="自定义jobhandler名称")”注解,注解value值对应的是调度中心新建任务的JobHandler属性的值。
+     - 4、执行日志:需要通过 "XxlJobLogger.log" 打印执行日志;
     (可参考Sample示例执行器中的DemoJobHandler,见下图)
 
 ![输入图片说明](https://static.oschina.net/uploads/img/201607/23232347_oLlM.png "在这里输入图片标题")
@@ -1073,32 +1075,33 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
 - 10、任务日志文件路径时间戳格式化时SimpleDateFormat并发问题解决;
 
 ### 6.20 版本 V1.9.0 特性[迭代中]
-- 1、新增任务运行模式 "GLUE模式(NodeJS) ",支持NodeJS脚本任务;
-- 2、脚本任务Shell、Python和Nodejs等支持获取分片参数;
-- 3、失败重试,完整支持:调度中心调度失败且启用"失败重试"策略时,将会自动重试一次;执行器执行失败且回调失败重试状态(新增失败重试状态返回值)时,也将会自动重试一次;
-- 4、失败告警策略扩展:默认提供邮件失败告警,可扩展短信等,扩展代码位置为 "JobFailMonitorHelper.failAlarm";
-- 5、执行器端口支持自动生成(小于等于0时),避免端口定义冲突;
-- 6、调度报表优化,支持时间区间筛选;
-- 7、Log组件支持输出异常栈信息,底层实现优化;
-- 8、告警邮件样式优化,调整为表格形式,邮件组件调整为commons-email简化邮件操作;
-- 9、项目依赖升级,如spring、jackson等;
-- 10、任务日志,记录发起调度的机器信息;
-- 11、交互优化,如登陆注销;
-- 12、任务Cron长度扩展支持至128位,支持负责类型Cron设置;
-- 13、执行器地址录入交互优化,地址长度扩展支持至512位,支持大规模执行器集群配置;
-- 14、任务参数“IJobHandler.execute”入参改为“String params”,增强入参通用性。
-- 15、JobHandler提供init/destroy方法,支持在JobHandler初始化和销毁时进行附加操作;
-- 16、任务注解调整为 “@JobHandler”,与任务抽象接口统一;
-- 17、修复任务监控线程被耗时任务阻塞的问题;
-- 18、修复任务监控线程无法监控任务触发和执行状态均未0的问题;
-- 19、执行器动态代理对象,拦截非业务方法的执行;
-- 20、修复JobThread捕获Error错误不更新JobLog的问题;
-- 21、修复任务列表界面左侧菜单合并时样式错乱问题;
-- 22、调度中心项目日志配置改为xml文件格式;
-- 23、Log地址格式兼容,支持非"/"结尾路径配置;
-- 24、底层系统日志级别规范调整,清理遗留代码;
-- 25、建表SQL优化,支持同步创建制定编码的库和表;
-- 26、Nutz执行器Sample示例项目;
+- 1、新增Nutz执行器Sample示例项目;
+- 2、新增任务运行模式 "GLUE模式(NodeJS) ",支持NodeJS脚本任务;
+- 3、脚本任务Shell、Python和Nodejs等支持获取分片参数;
+- 4、失败重试,完整支持:调度中心调度失败且启用"失败重试"策略时,将会自动重试一次;执行器执行失败且回调失败重试状态(新增失败重试状态返回值)时,也将会自动重试一次;
+- 5、失败告警策略扩展:默认提供邮件失败告警,可扩展短信等,扩展代码位置为 "JobFailMonitorHelper.failAlarm";
+- 6、执行器端口支持自动生成(小于等于0时),避免端口定义冲突;
+- 7、调度报表优化,支持时间区间筛选;
+- 8、Log组件支持输出异常栈信息,底层实现优化;
+- 9、告警邮件样式优化,调整为表格形式,邮件组件调整为commons-email简化邮件操作;
+- 10、项目依赖升级,如spring、jackson等;
+- 11、任务日志,记录发起调度的机器信息;
+- 12、交互优化,如登陆注销;
+- 13、任务Cron长度扩展支持至128位,支持负责类型Cron设置;
+- 14、执行器地址录入交互优化,地址长度扩展支持至512位,支持大规模执行器集群配置;
+- 15、任务参数“IJobHandler.execute”入参改为“String params”,增强入参通用性。
+- 16、JobHandler提供init/destroy方法,支持在JobHandler初始化和销毁时进行附加操作;
+- 17、任务注解调整为 “@JobHandler”,与任务抽象接口统一;
+- 18、修复任务监控线程被耗时任务阻塞的问题;
+- 19、修复任务监控线程无法监控任务触发和执行状态均未0的问题;
+- 20、执行器动态代理对象,拦截非业务方法的执行;
+- 21、修复JobThread捕获Error错误不更新JobLog的问题;
+- 22、修复任务列表界面左侧菜单合并时样式错乱问题;
+- 23、调度中心项目日志配置改为xml文件格式;
+- 24、Log地址格式兼容,支持非"/"结尾路径配置;
+- 25、底层系统日志级别规范调整,清理遗留代码;
+- 26、建表SQL优化,支持同步创建制定编码的库和表;
+
 
 
 ### TODO LIST

+ 2 - 1
xxl-job-executor-samples/xxl-job-executor-sample-jfinal/src/main/java/com/xuxueli/executor/sample/jfinal/config/JFinalCoreConfig.java

@@ -17,8 +17,9 @@ public class JFinalCoreConfig extends JFinalConfig {
 	private Logger logger = LoggerFactory.getLogger(JFinalCoreConfig.class);
 
 	// ---------------------- xxl-job executor ----------------------
-	XxlJobExecutor xxlJobExecutor = null;
+	private XxlJobExecutor xxlJobExecutor = null;
 	private void initXxlJobExecutor() {
+
 		// registry jobhandler
 		XxlJobExecutor.registJobHandler("demoJobHandler", new DemoJobHandler());
 		XxlJobExecutor.registJobHandler("shardingJobHandler", new ShardingJobHandler());

+ 1 - 0
xxl-job-executor-samples/xxl-job-executor-sample-jfinal/src/main/java/com/xuxueli/executor/sample/jfinal/controller/IndexController.java

@@ -7,4 +7,5 @@ public class IndexController extends Controller {
 	public void index(){
 		renderText("xxl job executor running.");
 	}
+
 }

+ 4 - 5
xxl-job-executor-samples/xxl-job-executor-sample-jfinal/src/main/java/com/xuxueli/executor/sample/jfinal/jobhandler/DemoJobHandler.java

@@ -6,14 +6,13 @@ import com.xxl.job.core.log.XxlJobLogger;
 
 import java.util.concurrent.TimeUnit;
 
-
 /**
- * 任务Handler的一个Demo(Bean模式)
+ * 任务Handler示例(Bean模式)
  *
  * 开发步骤:
- * 1、继承 “IJobHandler” 
- * 2、执行日志:需要通过 "XxlJobLogger.log" 打印执行日志;
- * 3、在 "JFinalCoreConfig" 中注册,执行Jobhandler名称
+ * 1、继承"IJobHandler":“com.xxl.job.core.handler.IJobHandler”
+ * 2、注册到执行器工厂:在 "JFinalCoreConfig.initXxlJobExecutor" 中手动注册,注解key值对应的是调度中心新建任务的JobHandler属性的值。
+ * 3、执行日志:需要通过 "XxlJobLogger.log" 打印执行日志
  *
  * @author xuxueli 2015-12-19 19:43:36
  */

+ 1 - 1
xxl-job-executor-samples/xxl-job-executor-sample-jfinal/src/main/resources/xxl-job-executor.properties

@@ -4,7 +4,7 @@ xxl.job.admin.addresses=http://127.0.0.1:8080/xxl-job-admin
 ### xxl-job executor address
 xxl.job.executor.appname=xxl-job-executor-sample
 xxl.job.executor.ip=
-xxl.job.executor.port=9997
+xxl.job.executor.port=9996
 
 ### xxl-job log path
 xxl.job.executor.logpath=/data/applogs/xxl-job/jobhandler

+ 6 - 0
xxl-job-executor-samples/xxl-job-executor-sample-jfinal/src/main/webapp/WEB-INF/web.xml

@@ -3,6 +3,7 @@
 	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
 	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
 	id="WebApp_ID" version="2.5">
+
 	<display-name>xxl-job-executor-sample-jfinal</display-name>
 	<context-param>
 		<param-name>webAppRootKey</param-name>
@@ -23,4 +24,9 @@
 		<url-pattern>/*</url-pattern>
 	</filter-mapping>
 
+
+	<welcome-file-list>
+		<welcome-file>index.html</welcome-file>
+	</welcome-file-list>
+
 </web-app>

+ 1 - 0
xxl-job-executor-samples/xxl-job-executor-sample-jfinal/src/main/webapp/index.html

@@ -0,0 +1 @@
+i am alive.

+ 12 - 15
xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/MainModule.java

@@ -1,26 +1,23 @@
 package com.xuxueli.executor.sample.nutz;
 
-import org.nutz.mvc.annotation.Encoding;
-import org.nutz.mvc.annotation.Fail;
-import org.nutz.mvc.annotation.IocBy;
-import org.nutz.mvc.annotation.Localization;
-import org.nutz.mvc.annotation.Modules;
-import org.nutz.mvc.annotation.Ok;
-import org.nutz.mvc.annotation.SetupBy;
+import com.xuxueli.executor.sample.nutz.config.NutzSetup;
+import org.nutz.mvc.annotation.*;
 import org.nutz.mvc.ioc.provider.ComboIocProvider;
+
 /**
- * 
- * @author 邓华锋
+ * nutz module
  *
+ * @author xuxueli 2017-12-25 17:58:43
  */
-@IocBy(type=ComboIocProvider.class,args={"*org.nutz.ioc.loader.json.JsonLoader","ioc/",
-	  "*org.nutz.ioc.loader.annotation.AnnotationIocLoader","com.xuxueli"})
-@Encoding(input="utf-8",output="utf-8")
-@Modules(scanPackage=true)
+@IocBy(type = ComboIocProvider.class,
+        args = {"*org.nutz.ioc.loader.annotation.AnnotationIocLoader",
+                "com.xuxueli.executor.sample.nutz"})
+@Encoding(input = "utf-8", output = "utf-8")
+@Modules(scanPackage = true)
 @Localization("msg")
 @Ok("json")
 @Fail("json")
-@SetupBy(MainSetup.class)
+@SetupBy(NutzSetup.class)
 public class MainModule {
-	
+
 }

+ 27 - 18
xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/MainSetup.java

@@ -1,33 +1,41 @@
-package com.xuxueli.executor.sample.nutz;
+package com.xuxueli.executor.sample.nutz.config;
 
-import org.nutz.ioc.IocException;
+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.log.Log;
-import org.nutz.log.Logs;
 import org.nutz.mvc.NutConfig;
 import org.nutz.mvc.Setup;
-
-import com.xxl.job.core.executor.XxlJobExecutor;
-import com.xxl.job.core.handler.IJobHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
- * 
- * @author 邓华锋
+ * nutz setup
  *
+ * @author xuxueli 2017-12-25 17:58:43
  */
-public class MainSetup implements Setup {
-	public static final Log log = Logs.get();
-	XxlJobExecutor xxlJobExecutor = null;
+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) {
-		// 通用注册IJobHandler
-		String[] names = cfg.getIoc().getNamesByType(IJobHandler.class);
-		for (String name : names) {
-			XxlJobExecutor.registJobHandler(name, cfg.getIoc().get(IJobHandler.class, name));
+
+		// 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);
 		}
+
 		// load executor prop
-		PropertiesProxy xxlJobProp = cfg.getIoc().get(PropertiesProxy.class, "conf");
+		PropertiesProxy xxlJobProp = new PropertiesProxy("xxl-job-executor.properties");
 
 		// init executor
 		xxlJobExecutor = new XxlJobExecutor();
@@ -42,7 +50,7 @@ public class MainSetup implements Setup {
 		try {
 			xxlJobExecutor.start();
 		} catch (Exception e) {
-			log.error(e.getMessage(), e);
+			logger.error(e.getMessage(), e);
 		}
 	}
 
@@ -52,4 +60,5 @@ public class MainSetup implements Setup {
 			xxlJobExecutor.destroy();
 		}
 	}
+
 }

+ 12 - 10
xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/jobhandler/DemoJobHandler.java

@@ -1,36 +1,38 @@
 package com.xuxueli.executor.sample.nutz.jobhandler;
 
-import java.util.concurrent.TimeUnit;
-
-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.handler.annotation.JobHandler;
 import com.xxl.job.core.log.XxlJobLogger;
+import org.nutz.ioc.loader.annotation.IocBean;
 
+import java.util.concurrent.TimeUnit;
 
 /**
- * 任务Handler的一个Demo(Bean模式)
+ * 任务Handler示例(Bean模式)
  *
  * 开发步骤:
- * 1、继承 “IJobHandler” ;
- * 2、执行日志:需要通过 "XxlJobLogger.log" 打印执行日志;
- * 3、在 "JFinalCoreConfig" 中注册,执行Jobhandler名称;
+ * 1、继承"IJobHandler":“com.xxl.job.core.handler.IJobHandler”;
+ * 2、注册到Nutz容器:添加“@IocBean”注解,被Nutz容器扫描为Bean实例;
+ * 3、注册到执行器工厂:添加“@JobHandler(value="自定义jobhandler名称")”注解,注解value值对应的是调度中心新建任务的JobHandler属性的值。
+ * 4、执行日志:需要通过 "XxlJobLogger.log" 打印执行日志;
  *
  * @author xuxueli 2015-12-19 19:43:36
  */
+@JobHandler(value="demoJobHandler")
 @IocBean
 public class DemoJobHandler extends IJobHandler {
 
 	@Override
-	public ReturnT<String> execute(String... params) throws Exception {
+	public ReturnT<String> execute(String param) throws Exception {
 		XxlJobLogger.log("XXL-JOB, Hello World.");
 
 		for (int i = 0; i < 5; i++) {
 			XxlJobLogger.log("beat at:" + i);
 			TimeUnit.SECONDS.sleep(2);
 		}
-		return ReturnT.SUCCESS;
+		return SUCCESS;
 	}
 
 }
+

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

@@ -1,5 +1,6 @@
 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;
@@ -7,17 +8,17 @@ import com.xxl.job.core.handler.IJobHandler;
 import com.xxl.job.core.log.XxlJobLogger;
 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
-	public ReturnT<String> execute(String... params) throws Exception {
+	public ReturnT<String> execute(String param) throws Exception {
 
 		// 分片参数
 		ShardingUtil.ShardingVO shardingVO = ShardingUtil.getShardingVo();
@@ -32,7 +33,7 @@ public class ShardingJobHandler extends IJobHandler {
 			}
 		}
 
-		return ReturnT.SUCCESS;
+		return SUCCESS;
 	}
-	
+
 }

+ 6 - 8
xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/module/IndexModule.java

@@ -3,16 +3,14 @@ package com.xuxueli.executor.sample.nutz.module;
 import org.nutz.ioc.loader.annotation.IocBean;
 import org.nutz.mvc.annotation.At;
 import org.nutz.mvc.annotation.Ok;
-/**
- * 
- * @author 邓华锋
- *
- */
+
 @IocBean
 public class IndexModule {
 	
-	@At
-	@Ok("jsp:index")
-	public void index() {
+	@At("/")
+	@Ok("json")
+	public String index() {
+		return "xxl job executor running.";
 	}
+
 }

+ 0 - 38
xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/resources/ioc/dao.js

@@ -1,38 +0,0 @@
-var ioc = {
-	conf : {
-		type : "org.nutz.ioc.impl.PropertiesProxy",
-		fields : {
-			paths : [ "custom/" ]
-		}
-	},
-	/**
-	 * 配置单例job执行
-	 */
-	/*xxlJobExecutor : {
-		type : "com.xxl.job.core.executor.XxlJobExecutor",
-		events : {
-			create : "start",
-			depose : "destroy"
-		},
-		fields : {
-			ip : {
-				java : "$conf.get('xxl.job.executor.ip')"
-			},
-			port : {
-				java : "$conf.get('xxl.job.executor.port')"
-			},
-			appName : {
-				java : "$conf.get('xxl.job.executor.appname')"
-			},
-			adminAddresses : {
-				java : "$conf.get('xxl.job.admin.addresses')"
-			},
-			logPath : {
-				java : "$conf.get('xxl.job.executor.logpath')"
-			},
-			accessToken : {
-				java : "$conf.get('xxl.job.accessToken')"
-			}
-		}
-	}*/
-};

+ 9 - 9
xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/resources/log4j.xml

@@ -2,19 +2,19 @@
 <!DOCTYPE log4j:configuration PUBLIC "-//log4j/log4j Configuration//EN" "log4j.dtd">
 <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" threshold="null" debug="null">
 
-	<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
-		<param name="Target" value="System.out" />
-		<layout class="org.apache.log4j.PatternLayout">
-            <param name="ConversionPattern" value="%-d{yyyy-MM-dd HH:mm:ss} spider-executor [%c]-[%t]-[%M]-[%L]-[%p] %m%n"/>
-		</layout>
-	</appender>
-	
+    <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+        <param name="Target" value="System.out" />
+        <layout class="org.apache.log4j.PatternLayout">
+            <param name="ConversionPattern" value="%-d{yyyy-MM-dd HH:mm:ss} xxl-job-executor-sample-nutz [%c]-[%t]-[%M]-[%L]-[%p] %m%n"/>
+        </layout>
+    </appender>
+
     <appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
-        <param name="file" value="/data/applogs/xxl-job/spider-executor.log"/>
+        <param name="file" value="/data/applogs/xxl-job/xxl-job-executor-sample-nutz.log"/>
         <param name="append" value="true"/>
         <param name="encoding" value="UTF-8"/>
         <layout class="org.apache.log4j.PatternLayout">
-            <param name="ConversionPattern" value="%-d{yyyy-MM-dd HH:mm:ss} spider-executor [%c]-[%t]-[%M]-[%L]-[%p] %m%n"/>
+            <param name="ConversionPattern" value="%-d{yyyy-MM-dd HH:mm:ss} xxl-job-executor-sample-nutz [%c]-[%t]-[%M]-[%L]-[%p] %m%n"/>
         </layout>
     </appender>
 

+ 2 - 2
xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/resources/custom/xxl-job-executor.properties

@@ -4,10 +4,10 @@ xxl.job.admin.addresses=http://127.0.0.1:8080/xxl-job-admin
 ### xxl-job executor address
 xxl.job.executor.appname=xxl-job-executor-sample
 xxl.job.executor.ip=
-xxl.job.executor.port=1024
+xxl.job.executor.port=9997
 
 ### xxl-job log path
-xxl.job.executor.logpath=/data/applogs/xxl-job/jobhandler/
+xxl.job.executor.logpath=/data/applogs/xxl-job/jobhandler
 
 ### xxl-job, access token
 xxl.job.accessToken=

+ 0 - 12
xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/webapp/WEB-INF/index.jsp

@@ -1,12 +0,0 @@
-<%@ page language="java" contentType="text/html; charset=UTF-8"
-    pageEncoding="UTF-8"%>
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<title>nutz 执行器启动成功</title>
-</head>
-<body>
-nutz 执行器启动成功!
-</body>
-</html>

+ 13 - 3
xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/webapp/WEB-INF/web.xml

@@ -3,9 +3,16 @@
 	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
 	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
 	id="WebApp_ID" version="2.5">
+
 	<display-name>xxl-job-executor-sample-nutz</display-name>
+	<context-param>
+		<param-name>webAppRootKey</param-name>
+		<param-value>xxl-job-executor-sample-nutz</param-value>
+	</context-param>
+
+	<!-- nutz -->
 	<filter>
-		<filter-name>xxl-job-executor-sample-nutz</filter-name>
+		<filter-name>nutz</filter-name>
 		<filter-class>org.nutz.mvc.NutFilter</filter-class>
 		<init-param>
 			<param-name>modules</param-name>
@@ -13,10 +20,13 @@
 		</init-param>
 	</filter>
 	<filter-mapping>
-		<filter-name>xxl-job-executor-sample-nutz</filter-name>
+		<filter-name>nutz</filter-name>
 		<url-pattern>/*</url-pattern>
 	</filter-mapping>
+
+
 	<welcome-file-list>
-		<welcome-file>index</welcome-file>
+		<welcome-file>index.html</welcome-file>
 	</welcome-file-list>
+
 </web-app>

+ 0 - 0
xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/webapp/index


+ 1 - 0
xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/webapp/index.html

@@ -0,0 +1 @@
+i am alive.

+ 4 - 4
xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/java/com/xxl/job/executor/service/jobhandler/DemoJobHandler.java

@@ -10,12 +10,12 @@ import java.util.concurrent.TimeUnit;
 
 
 /**
- * 任务Handler的一个Demo(Bean模式)
+ * 任务Handler示例(Bean模式)
  * 
  * 开发步骤:
- * 1、新建一个继承com.xxl.job.core.handler.IJobHandler的Java类
- * 2、该类被Spring容器扫描为Bean实例,如加“@Component”注解
- * 3、添加 “@JobHandler(value="自定义jobhandler名称")”注解,注解value值为自定义的JobHandler名称,该名称对应的是调度中心新建任务的JobHandler属性的值。
+ * 1、继承"IJobHandler":“com.xxl.job.core.handler.IJobHandler”
+ * 2、注册到Spring容器:添加“@Component”注解,被Spring容器扫描为Bean实例
+ * 3、注册到执行器工厂:添加“@JobHandler(value="自定义jobhandler名称")”注解,注解value值对应的是调度中心新建任务的JobHandler属性的值。
  * 4、执行日志:需要通过 "XxlJobLogger.log" 打印执行日志;
  * 
  * @author xuxueli 2015-12-19 19:43:36

+ 5 - 2
xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/webapp/WEB-INF/web.xml

@@ -3,12 +3,14 @@
 	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee"
 	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
 	id="WebApp_ID" version="2.5">
+
 	<display-name>xxl-job-executor-sample-spring</display-name>
 	<context-param>
 	    <param-name>webAppRootKey</param-name>
 	    <param-value>xxl-job-executor-sample-spring</param-value>
 	</context-param>
-	
+
+	<!-- spring -->
 	<context-param>
 		<param-name>contextConfigLocation</param-name>
 		<param-value>classpath*:applicationcontext-*.xml</param-value>
@@ -20,7 +22,8 @@
 	<listener>
 		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
 	</listener>
-	
+
+
 	<welcome-file-list>
 		<welcome-file>index.html</welcome-file>
 	</welcome-file-list>

+ 1 - 1
xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/webapp/index.html

@@ -1 +1 @@
-200
+i am alive.

+ 4 - 4
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/service/jobhandler/DemoJobHandler.java

@@ -10,12 +10,12 @@ import java.util.concurrent.TimeUnit;
 
 
 /**
- * 任务Handler的一个Demo(Bean模式)
+ * 任务Handler示例(Bean模式)
  *
  * 开发步骤:
- * 1、新建一个继承com.xxl.job.core.handler.IJobHandler的Java类
- * 2、该类被Spring容器扫描为Bean实例,如加“@Component”注解
- * 3、添加 “@JobHandler(value="自定义jobhandler名称")”注解,注解value值为自定义的JobHandler名称,该名称对应的是调度中心新建任务的JobHandler属性的值。
+ * 1、继承"IJobHandler":“com.xxl.job.core.handler.IJobHandler”
+ * 2、注册到Spring容器:添加“@Component”注解,被Spring容器扫描为Bean实例
+ * 3、注册到执行器工厂:添加“@JobHandler(value="自定义jobhandler名称")”注解,注解value值对应的是调度中心新建任务的JobHandler属性的值。
  * 4、执行日志:需要通过 "XxlJobLogger.log" 打印执行日志;
  *
  * @author xuxueli 2015-12-19 19:43:36

+ 1 - 1
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/application.properties

@@ -11,7 +11,7 @@ xxl.job.admin.addresses=http://127.0.0.1:8080/xxl-job-admin
 ### xxl-job executor address
 xxl.job.executor.appname=xxl-job-executor-sample
 xxl.job.executor.ip=
-xxl.job.executor.port=-1
+xxl.job.executor.port=9998
 
 ### xxl-job log path
 xxl.job.executor.logpath=/data/applogs/xxl-job/jobhandler