From 85179937cc5daa44aed5a9d80374cf8ba5cca129 Mon Sep 17 00:00:00 2001
From: xuxueli <931591021@qq.com>
Date: Fri, 11 Aug 2017 14:04:46 +0800
Subject: [PATCH] =?UTF-8?q?=E8=A7=84=E8=8C=83=E9=A1=B9=E7=9B=AE=E7=9B=AE?=
=?UTF-8?q?=E5=BD=95=EF=BC=8C=E6=96=B9=E4=BE=BF=E6=89=A9=E5=B1=95=E5=A4=9A?=
=?UTF-8?q?=E6=89=A7=E8=A1=8C=E5=99=A8=EF=BC=9B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
NOTICE | 2 +-
README.md | 2 +-
...on.md => XXL-JOB-English-Documentation.md} | 0
doc/XXL-JOB官方文档.md | 37 +-
.../db}/tables_mysql(备份,请忽略).sql | 0
{db => doc/db}/tables_xxl_job.sql | 440 +++++++++---------
pom.xml | 3 +-
.../xxl/job/core/executor/XxlJobExecutor.java | 4 +-
.../xxl/job/core/log/XxlJobFileAppender.java | 2 +-
xxl-job-executor-samples/pom.xml | 18 +
.../xxl-job-executor-sample-spring}/pom.xml | 76 +--
.../service/jobhandler/DemoJobHandler.java | 76 +--
.../jobhandler/ShardingJobHandler.java | 0
.../resources/applicationcontext-xxl-job.xml | 80 ++--
.../src/main/resources/log4j.xml | 6 +-
.../resources/xxl-job-executor.properties | 2 +-
.../src/main/webapp/WEB-INF/web.xml | 52 +--
.../src/main/webapp/index.html | 0
.../xxl/executor/test/DemoJobHandlerTest.java | 0
.../pom.xml | 4 +-
.../com/xxl/job/executor/Application.java | 0
.../executor/core/config/XxlJobConfig.java | 0
.../mvc/controller/IndexController.java | 0
.../service/jobhandler/DemoJobHandler.java | 0
.../jobhandler/ShardingJobHandler.java | 0
.../src/main/resources/application.properties | 2 +-
.../src/main/resources/logback.xml | 2 +-
...obExecutorExampleBootApplicationTests.java | 0
28 files changed, 416 insertions(+), 392 deletions(-)
rename doc/{XXL-JOB-Englis-Documentation.md => XXL-JOB-English-Documentation.md} (100%)
rename {db => doc/db}/tables_mysql(备份,请忽略).sql (100%)
rename {db => doc/db}/tables_xxl_job.sql (96%)
create mode 100644 xxl-job-executor-samples/pom.xml
rename {xxl-job-executor-example => xxl-job-executor-samples/xxl-job-executor-sample-spring}/pom.xml (88%)
rename {xxl-job-executor-example => xxl-job-executor-samples/xxl-job-executor-sample-spring}/src/main/java/com/xxl/job/executor/service/jobhandler/DemoJobHandler.java (97%)
rename {xxl-job-executor-example => xxl-job-executor-samples/xxl-job-executor-sample-spring}/src/main/java/com/xxl/job/executor/service/jobhandler/ShardingJobHandler.java (100%)
rename {xxl-job-executor-example => xxl-job-executor-samples/xxl-job-executor-sample-spring}/src/main/resources/applicationcontext-xxl-job.xml (97%)
rename {xxl-job-executor-example => xxl-job-executor-samples/xxl-job-executor-sample-spring}/src/main/resources/log4j.xml (85%)
rename {xxl-job-executor-example => xxl-job-executor-samples/xxl-job-executor-sample-spring}/src/main/resources/xxl-job-executor.properties (83%)
rename {xxl-job-executor-example => xxl-job-executor-samples/xxl-job-executor-sample-spring}/src/main/webapp/WEB-INF/web.xml (90%)
rename {xxl-job-executor-example => xxl-job-executor-samples/xxl-job-executor-sample-spring}/src/main/webapp/index.html (100%)
rename {xxl-job-executor-example => xxl-job-executor-samples/xxl-job-executor-sample-spring}/src/test/java/com/xxl/executor/test/DemoJobHandlerTest.java (100%)
rename {xxl-job-executor-springboot-example => xxl-job-executor-samples/xxl-job-executor-sample-springboot}/pom.xml (96%)
rename {xxl-job-executor-springboot-example => xxl-job-executor-samples/xxl-job-executor-sample-springboot}/src/main/java/com/xxl/job/executor/Application.java (100%)
rename {xxl-job-executor-springboot-example => xxl-job-executor-samples/xxl-job-executor-sample-springboot}/src/main/java/com/xxl/job/executor/core/config/XxlJobConfig.java (100%)
rename {xxl-job-executor-springboot-example => xxl-job-executor-samples/xxl-job-executor-sample-springboot}/src/main/java/com/xxl/job/executor/mvc/controller/IndexController.java (100%)
rename {xxl-job-executor-springboot-example => xxl-job-executor-samples/xxl-job-executor-sample-springboot}/src/main/java/com/xxl/job/executor/service/jobhandler/DemoJobHandler.java (100%)
rename {xxl-job-executor-springboot-example => xxl-job-executor-samples/xxl-job-executor-sample-springboot}/src/main/java/com/xxl/job/executor/service/jobhandler/ShardingJobHandler.java (100%)
rename {xxl-job-executor-springboot-example => xxl-job-executor-samples/xxl-job-executor-sample-springboot}/src/main/resources/application.properties (90%)
rename {xxl-job-executor-springboot-example => xxl-job-executor-samples/xxl-job-executor-sample-springboot}/src/main/resources/logback.xml (96%)
rename {xxl-job-executor-springboot-example => xxl-job-executor-samples/xxl-job-executor-sample-springboot}/src/test/java/com/xxl/job/executor/test/XxlJobExecutorExampleBootApplicationTests.java (100%)
diff --git a/NOTICE b/NOTICE
index f87996a1..0fa19a5d 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,4 +1,4 @@
-Copyright 2015-2017/NOW xuxueli.
+Copyright (c) 2015-present, xuxueli.
Dependencies:
================================================================
diff --git a/README.md b/README.md
index c3d5c4f0..804e80e9 100644
--- a/README.md
+++ b/README.md
@@ -38,7 +38,7 @@ XXL-JOB是一个轻量级分布式任务调度框架,其核心设计目标是
## Documentation
- [中文文档](https://github.com/xuxueli/xxl-job/blob/master/doc/XXL-JOB官方文档.md)
-- [Englis Documentation](https://github.com/xuxueli/xxl-job/blob/master/doc/XXL-JOB-Englis-Documentation.md)
+- [English Documentation](https://github.com/xuxueli/xxl-job/blob/master/doc/XXL-JOB-English-Documentation.md)
## Features
diff --git a/doc/XXL-JOB-Englis-Documentation.md b/doc/XXL-JOB-English-Documentation.md
similarity index 100%
rename from doc/XXL-JOB-Englis-Documentation.md
rename to doc/XXL-JOB-English-Documentation.md
diff --git a/doc/XXL-JOB官方文档.md b/doc/XXL-JOB官方文档.md
index e4d6318d..300ca95d 100644
--- a/doc/XXL-JOB官方文档.md
+++ b/doc/XXL-JOB官方文档.md
@@ -122,11 +122,11 @@ XXL-JOB是一个轻量级分布式任务调度框架,其核心设计目标是
#### 技术交流
- 腾讯QQ群(6):399758605
-- 腾讯QQ群(5):138274130 (群即将满,请加群6)
-- 腾讯QQ群(4):464762661 (群即将满,请加群6)
-- 腾讯QQ群(3):242151780 (群即将满,请加群6)
-- 腾讯QQ群(2):438249535 (群即将满,请加群6)
-- 腾讯QQ群(1):367260654 (群即将满,请加群6)
+- 腾讯QQ群(5):138274130
+- 腾讯QQ群(4):464762661
+- 腾讯QQ群(3):242151780
+- 腾讯QQ群(2):438249535
+- 腾讯QQ群(1):367260654
### 1.5 环境
- JDK:1.7+
@@ -144,7 +144,7 @@ XXL-JOB是一个轻量级分布式任务调度框架,其核心设计目标是
"调度数据库初始化SQL脚本" 位置为:
- /xxl-job/db/tables_xxl_job.sql
+ /xxl-job/doc/db/tables_xxl_job.sql
调度中心支持集群部署,集群情况下各节点务必连接同一个mysql实例;
@@ -155,8 +155,9 @@ XXL-JOB是一个轻量级分布式任务调度框架,其核心设计目标是
xxl-job-admin:调度中心
xxl-job-core:公共依赖
- xxl-job-executor-example:执行器Example(可直接使用执行器Example,也可以将现有项目改造成执行器使用)
- xxl-job-executor-springboot-example:执行器Example,springboot版本
+ xxl-job-executor:执行器Example项目
+ :xxl-job-executor-sample-spring:执行器Example,Spring版本(可直接使用执行器Example,也可以将现有项目改造成执行器使用)
+ :xxl-job-executor-sample-springboot:执行器Example,Springboot版本
### 2.3 配置部署“调度中心”
@@ -209,7 +210,7 @@ XXL-JOB是一个轻量级分布式任务调度框架,其核心设计目标是
### 2.4 配置部署“执行器项目”
- “执行器”项目:xxl-job-executor-example (如新建执行器项目,可参考该Example执行器项目的配置步骤;)
+ “执行器”项目:xxl-job-executor-sample-spring (如新建执行器项目,可参考该Example执行器项目的配置步骤;)
作用:负责接收“调度中心”的调度并执行;
#### 步骤一:maven依赖
@@ -218,7 +219,7 @@ XXL-JOB是一个轻量级分布式任务调度框架,其核心设计目标是
#### 步骤二:执行器配置
执行器配置配置文件地址:
- /xxl-job/xxl-job-executor-example/src/main/resources/xxl-job-executor.properties
+ /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/resources/xxl-job-executor.properties
执行器配置配置内容说明:
@@ -226,7 +227,7 @@ XXL-JOB是一个轻量级分布式任务调度框架,其核心设计目标是
xxl.job.admin.addresses=http://127.0.0.1:8080/xxl-job-admin
### xxl-job executor address:执行器"AppName"和地址信息配置:AppName执行器心跳注册分组依据;地址信息用于"调度中心请求并触发任务"和"执行器注册"。执行器默认端口为9999,执行器IP默认为空表示自动获取IP,多网卡时可手动设置指定IP。单机部署多个执行器时,注意要配置不同执行器端口;
- xxl.job.executor.appname=xxl-job-executor-example
+ xxl.job.executor.appname=xxl-job-executor-sample
xxl.job.executor.ip=
xxl.job.executor.port=9999
@@ -248,8 +249,8 @@ XXL-JOB是一个轻量级分布式任务调度框架,其核心设计目标是
#### 步骤四:部署执行器项目:
如果已经正确进行上述配置,可将执行器项目编译打部署,系统提供两个执行器example项目,选择其中一个即可,各自的部署方式如下。
- xxl-job-executor-example:项目编译打包成WAR包,并部署到tomcat中。
- xxl-job-executor-springboot-example:项目编译打包成springboot类型的可执行JAR包,命令启动即可;
+ xxl-job-executor-sample-spring:项目编译打包成WAR包,并部署到tomcat中。
+ xxl-job-executor-sample-springboot:项目编译打包成springboot类型的可执行JAR包,命令启动即可;
至此“执行器”项目已经部署结束。
@@ -326,7 +327,7 @@ XXL-JOB是一个轻量级分布式任务调度框架,其核心设计目标是
- 失败处理策略;调度失败时的处理策略;
失败告警(默认):调度失败时,将会触发失败报警,如发送报警邮件;
失败重试:调度失败时,将会主动进行一次失败重试调度,重试调度后仍然失败将会触发一失败告警。注意当任务以failover方式路由时,每次失败重试将会触发新一轮路由。
- - 执行参数:任务执行所需的参数,多个参数时用逗号分隔,任务执行时将会把多个参数抓换成数组传入;
+ - 执行参数:任务执行所需的参数,多个参数时用逗号分隔,任务执行时将会把多个参数转换成数组传入;
- 报警邮件:任务调度失败时邮件通知的邮箱地址,支持配置多邮箱地址,配置多个邮箱地址时用逗号分隔;
- 负责人:任务的负责人;
@@ -337,7 +338,7 @@ XXL-JOB是一个轻量级分布式任务调度框架,其核心设计目标是
- 1、 新建一个继承com.xxl.job.core.handler.IJobHandler的Java类;
- 2、 该类被Spring容器扫描为Bean实例,如加“@Component”注解;
- 3、 添加 “@JobHander(value="自定义jobhandler名称")”注解,注解的value值为自定义的JobHandler名称,该名称对应的是调度中心新建任务的JobHandler属性的值。
- (可参考xxl-job-executor-example项目中的DemoJobHandler,见下图)
+ (可参考Example执行器中的DemoJobHandler,见下图)
![输入图片说明](https://static.oschina.net/uploads/img/201607/23232347_oLlM.png "在这里输入图片标题")
@@ -495,7 +496,7 @@ try{
- /db :“调度数据库”建表脚本
- /xxl-job-admin :调度中心,项目源码
- /xxl-job-core :公共Jar依赖
- - /xxl-job-executor-example :执行器,Demo项目源码(大家可以在该项目上进行开发,也可以将现有项目改造生成执行器项目)
+ - /xxl-job-executor-samples :执行器,Example项目(大家可以在该项目上进行开发,也可以将现有项目改造生成执行器项目)
#### 5.2 “调度数据库”配置
XXL-JOB调度模块基于Quartz集群实现,其“调度数据库”是在Quartz的11张集群mysql表基础上扩展而成。
@@ -944,6 +945,10 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
- 10、springboot版本执行器,升级至1.5.6.RELEASE版本;
- 11、统一maven依赖版本管理;
+#### 6.18 版本 V1.8.2 特性[Coding]
+- 1、解决执行器回调URL不支持配置HTTPS时问题;
+- 2、规范项目目录,方便扩展多执行器;
+
#### TODO LIST
- 1、任务权限管理:执行器为粒度分配权限,核心操作校验权限;
- 2、任务分片路由:分片采用一致性Hash算法计算出尽量稳定的分片顺序,即使注册机器存在波动也不会引起分批分片顺序大的波动;目前采用IP自然排序,可以满足需求,待定;
diff --git a/db/tables_mysql(备份,请忽略).sql b/doc/db/tables_mysql(备份,请忽略).sql
similarity index 100%
rename from db/tables_mysql(备份,请忽略).sql
rename to doc/db/tables_mysql(备份,请忽略).sql
diff --git a/db/tables_xxl_job.sql b/doc/db/tables_xxl_job.sql
similarity index 96%
rename from db/tables_xxl_job.sql
rename to doc/db/tables_xxl_job.sql
index 585467c5..3441f147 100644
--- a/db/tables_xxl_job.sql
+++ b/doc/db/tables_xxl_job.sql
@@ -1,220 +1,220 @@
-
-CREATE TABLE XXL_JOB_QRTZ_JOB_DETAILS
- (
- SCHED_NAME VARCHAR(120) NOT NULL,
- JOB_NAME VARCHAR(200) NOT NULL,
- JOB_GROUP VARCHAR(200) NOT NULL,
- DESCRIPTION VARCHAR(250) NULL,
- JOB_CLASS_NAME VARCHAR(250) NOT NULL,
- IS_DURABLE VARCHAR(1) NOT NULL,
- IS_NONCONCURRENT VARCHAR(1) NOT NULL,
- IS_UPDATE_DATA VARCHAR(1) NOT NULL,
- REQUESTS_RECOVERY VARCHAR(1) NOT NULL,
- JOB_DATA BLOB NULL,
- PRIMARY KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)
-);
-
-CREATE TABLE XXL_JOB_QRTZ_TRIGGERS
- (
- SCHED_NAME VARCHAR(120) NOT NULL,
- TRIGGER_NAME VARCHAR(200) NOT NULL,
- TRIGGER_GROUP VARCHAR(200) NOT NULL,
- JOB_NAME VARCHAR(200) NOT NULL,
- JOB_GROUP VARCHAR(200) NOT NULL,
- DESCRIPTION VARCHAR(250) NULL,
- NEXT_FIRE_TIME BIGINT(13) NULL,
- PREV_FIRE_TIME BIGINT(13) NULL,
- PRIORITY INTEGER NULL,
- TRIGGER_STATE VARCHAR(16) NOT NULL,
- TRIGGER_TYPE VARCHAR(8) NOT NULL,
- START_TIME BIGINT(13) NOT NULL,
- END_TIME BIGINT(13) NULL,
- CALENDAR_NAME VARCHAR(200) NULL,
- MISFIRE_INSTR SMALLINT(2) NULL,
- JOB_DATA BLOB NULL,
- PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
- FOREIGN KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)
- REFERENCES XXL_JOB_QRTZ_JOB_DETAILS(SCHED_NAME,JOB_NAME,JOB_GROUP)
-);
-
-CREATE TABLE XXL_JOB_QRTZ_SIMPLE_TRIGGERS
- (
- SCHED_NAME VARCHAR(120) NOT NULL,
- TRIGGER_NAME VARCHAR(200) NOT NULL,
- TRIGGER_GROUP VARCHAR(200) NOT NULL,
- REPEAT_COUNT BIGINT(7) NOT NULL,
- REPEAT_INTERVAL BIGINT(12) NOT NULL,
- TIMES_TRIGGERED BIGINT(10) NOT NULL,
- PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
- FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
- REFERENCES XXL_JOB_QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
-);
-
-CREATE TABLE XXL_JOB_QRTZ_CRON_TRIGGERS
- (
- SCHED_NAME VARCHAR(120) NOT NULL,
- TRIGGER_NAME VARCHAR(200) NOT NULL,
- TRIGGER_GROUP VARCHAR(200) NOT NULL,
- CRON_EXPRESSION VARCHAR(200) NOT NULL,
- TIME_ZONE_ID VARCHAR(80),
- PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
- FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
- REFERENCES XXL_JOB_QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
-);
-
-CREATE TABLE XXL_JOB_QRTZ_SIMPROP_TRIGGERS
- (
- SCHED_NAME VARCHAR(120) NOT NULL,
- TRIGGER_NAME VARCHAR(200) NOT NULL,
- TRIGGER_GROUP VARCHAR(200) NOT NULL,
- STR_PROP_1 VARCHAR(512) NULL,
- STR_PROP_2 VARCHAR(512) NULL,
- STR_PROP_3 VARCHAR(512) NULL,
- INT_PROP_1 INT NULL,
- INT_PROP_2 INT NULL,
- LONG_PROP_1 BIGINT NULL,
- LONG_PROP_2 BIGINT NULL,
- DEC_PROP_1 NUMERIC(13,4) NULL,
- DEC_PROP_2 NUMERIC(13,4) NULL,
- BOOL_PROP_1 VARCHAR(1) NULL,
- BOOL_PROP_2 VARCHAR(1) NULL,
- PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
- FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
- REFERENCES XXL_JOB_QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
-);
-
-CREATE TABLE XXL_JOB_QRTZ_BLOB_TRIGGERS
- (
- SCHED_NAME VARCHAR(120) NOT NULL,
- TRIGGER_NAME VARCHAR(200) NOT NULL,
- TRIGGER_GROUP VARCHAR(200) NOT NULL,
- BLOB_DATA BLOB NULL,
- PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
- FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
- REFERENCES XXL_JOB_QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
-);
-
-CREATE TABLE XXL_JOB_QRTZ_CALENDARS
- (
- SCHED_NAME VARCHAR(120) NOT NULL,
- CALENDAR_NAME VARCHAR(200) NOT NULL,
- CALENDAR BLOB NOT NULL,
- PRIMARY KEY (SCHED_NAME,CALENDAR_NAME)
-);
-
-CREATE TABLE XXL_JOB_QRTZ_PAUSED_TRIGGER_GRPS
- (
- SCHED_NAME VARCHAR(120) NOT NULL,
- TRIGGER_GROUP VARCHAR(200) NOT NULL,
- PRIMARY KEY (SCHED_NAME,TRIGGER_GROUP)
-);
-
-CREATE TABLE XXL_JOB_QRTZ_FIRED_TRIGGERS
- (
- SCHED_NAME VARCHAR(120) NOT NULL,
- ENTRY_ID VARCHAR(95) NOT NULL,
- TRIGGER_NAME VARCHAR(200) NOT NULL,
- TRIGGER_GROUP VARCHAR(200) NOT NULL,
- INSTANCE_NAME VARCHAR(200) NOT NULL,
- FIRED_TIME BIGINT(13) NOT NULL,
- SCHED_TIME BIGINT(13) NOT NULL,
- PRIORITY INTEGER NOT NULL,
- STATE VARCHAR(16) NOT NULL,
- JOB_NAME VARCHAR(200) NULL,
- JOB_GROUP VARCHAR(200) NULL,
- IS_NONCONCURRENT VARCHAR(1) NULL,
- REQUESTS_RECOVERY VARCHAR(1) NULL,
- PRIMARY KEY (SCHED_NAME,ENTRY_ID)
-);
-
-CREATE TABLE XXL_JOB_QRTZ_SCHEDULER_STATE
- (
- SCHED_NAME VARCHAR(120) NOT NULL,
- INSTANCE_NAME VARCHAR(200) NOT NULL,
- LAST_CHECKIN_TIME BIGINT(13) NOT NULL,
- CHECKIN_INTERVAL BIGINT(13) NOT NULL,
- PRIMARY KEY (SCHED_NAME,INSTANCE_NAME)
-);
-
-CREATE TABLE XXL_JOB_QRTZ_LOCKS
- (
- SCHED_NAME VARCHAR(120) NOT NULL,
- LOCK_NAME VARCHAR(40) NOT NULL,
- PRIMARY KEY (SCHED_NAME,LOCK_NAME)
-);
-
-
-
-CREATE TABLE `XXL_JOB_QRTZ_TRIGGER_INFO` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `job_group` int(11) NOT NULL COMMENT '执行器主键ID',
- `job_cron` varchar(128) NOT NULL COMMENT '任务执行CRON',
- `job_desc` varchar(255) NOT NULL,
- `add_time` datetime DEFAULT NULL,
- `update_time` datetime DEFAULT NULL,
- `author` varchar(64) DEFAULT NULL COMMENT '作者',
- `alarm_email` varchar(255) DEFAULT NULL COMMENT '报警邮件',
- `executor_route_strategy` varchar(50) DEFAULT NULL COMMENT '执行器路由策略',
- `executor_handler` varchar(255) DEFAULT NULL COMMENT '执行器任务handler',
- `executor_param` varchar(255) DEFAULT NULL COMMENT '执行器任务参数',
- `executor_block_strategy` varchar(50) DEFAULT NULL COMMENT '阻塞处理策略',
- `executor_fail_strategy` varchar(50) DEFAULT NULL COMMENT '失败处理策略',
- `glue_type` varchar(50) NOT NULL COMMENT 'GLUE类型',
- `glue_source` text COMMENT 'GLUE源代码',
- `glue_remark` varchar(128) DEFAULT NULL COMMENT 'GLUE备注',
- `glue_updatetime` datetime DEFAULT NULL COMMENT 'GLUE更新时间',
- `child_jobkey` varchar(255) DEFAULT NULL COMMENT '子任务Key',
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
-CREATE TABLE `XXL_JOB_QRTZ_TRIGGER_LOG` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `job_group` int(11) NOT NULL COMMENT '执行器主键ID',
- `job_id` int(11) NOT NULL COMMENT '任务,主键ID',
- `glue_type` varchar(50) DEFAULT NULL COMMENT 'GLUE类型',
- `executor_address` varchar(255) DEFAULT NULL COMMENT '执行器地址,本次执行的地址',
- `executor_handler` varchar(255) DEFAULT NULL COMMENT '执行器任务handler',
- `executor_param` varchar(255) DEFAULT NULL COMMENT 'executor_param',
- `trigger_time` datetime DEFAULT NULL COMMENT '调度-时间',
- `trigger_code` varchar(255) NOT NULL DEFAULT '0' COMMENT '调度-结果',
- `trigger_msg` varchar(2048) DEFAULT NULL COMMENT '调度-日志',
- `handle_time` datetime DEFAULT NULL COMMENT '执行-时间',
- `handle_code` varchar(255) NOT NULL DEFAULT '0' COMMENT '执行-状态',
- `handle_msg` varchar(2048) DEFAULT NULL COMMENT '执行-日志',
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
-CREATE TABLE `XXL_JOB_QRTZ_TRIGGER_LOGGLUE` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `job_id` int(11) NOT NULL COMMENT '任务,主键ID',
- `glue_type` varchar(50) DEFAULT NULL COMMENT 'GLUE类型',
- `glue_source` text COMMENT 'GLUE源代码',
- `glue_remark` varchar(128) NOT NULL COMMENT 'GLUE备注',
- `add_time` timestamp NULL DEFAULT NULL,
- `update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
-CREATE TABLE XXL_JOB_QRTZ_TRIGGER_REGISTRY (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `registry_group` varchar(255) NOT NULL,
- `registry_key` varchar(255) NOT NULL,
- `registry_value` varchar(255) NOT NULL,
- `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
-CREATE TABLE `XXL_JOB_QRTZ_TRIGGER_GROUP` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `app_name` varchar(64) NOT NULL COMMENT '执行器AppName',
- `title` varchar(12) NOT NULL COMMENT '执行器名称',
- `order` tinyint(4) NOT NULL DEFAULT '0' COMMENT '排序',
- `address_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '执行器地址类型:0=自动注册、1=手动录入',
- `address_list` varchar(200) DEFAULT NULL COMMENT '执行器地址列表,多地址逗号分隔',
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
-INSERT INTO `XXL_JOB_QRTZ_TRIGGER_GROUP` ( `app_name`, `title`, `order`, `address_type`, `address_list`) values ( 'xxl-job-executor-example', '示例执行器', '1', '0', null);
-
-commit;
-
+
+CREATE TABLE XXL_JOB_QRTZ_JOB_DETAILS
+ (
+ SCHED_NAME VARCHAR(120) NOT NULL,
+ JOB_NAME VARCHAR(200) NOT NULL,
+ JOB_GROUP VARCHAR(200) NOT NULL,
+ DESCRIPTION VARCHAR(250) NULL,
+ JOB_CLASS_NAME VARCHAR(250) NOT NULL,
+ IS_DURABLE VARCHAR(1) NOT NULL,
+ IS_NONCONCURRENT VARCHAR(1) NOT NULL,
+ IS_UPDATE_DATA VARCHAR(1) NOT NULL,
+ REQUESTS_RECOVERY VARCHAR(1) NOT NULL,
+ JOB_DATA BLOB NULL,
+ PRIMARY KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)
+);
+
+CREATE TABLE XXL_JOB_QRTZ_TRIGGERS
+ (
+ SCHED_NAME VARCHAR(120) NOT NULL,
+ TRIGGER_NAME VARCHAR(200) NOT NULL,
+ TRIGGER_GROUP VARCHAR(200) NOT NULL,
+ JOB_NAME VARCHAR(200) NOT NULL,
+ JOB_GROUP VARCHAR(200) NOT NULL,
+ DESCRIPTION VARCHAR(250) NULL,
+ NEXT_FIRE_TIME BIGINT(13) NULL,
+ PREV_FIRE_TIME BIGINT(13) NULL,
+ PRIORITY INTEGER NULL,
+ TRIGGER_STATE VARCHAR(16) NOT NULL,
+ TRIGGER_TYPE VARCHAR(8) NOT NULL,
+ START_TIME BIGINT(13) NOT NULL,
+ END_TIME BIGINT(13) NULL,
+ CALENDAR_NAME VARCHAR(200) NULL,
+ MISFIRE_INSTR SMALLINT(2) NULL,
+ JOB_DATA BLOB NULL,
+ PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
+ FOREIGN KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)
+ REFERENCES XXL_JOB_QRTZ_JOB_DETAILS(SCHED_NAME,JOB_NAME,JOB_GROUP)
+);
+
+CREATE TABLE XXL_JOB_QRTZ_SIMPLE_TRIGGERS
+ (
+ SCHED_NAME VARCHAR(120) NOT NULL,
+ TRIGGER_NAME VARCHAR(200) NOT NULL,
+ TRIGGER_GROUP VARCHAR(200) NOT NULL,
+ REPEAT_COUNT BIGINT(7) NOT NULL,
+ REPEAT_INTERVAL BIGINT(12) NOT NULL,
+ TIMES_TRIGGERED BIGINT(10) NOT NULL,
+ PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
+ FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
+ REFERENCES XXL_JOB_QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
+);
+
+CREATE TABLE XXL_JOB_QRTZ_CRON_TRIGGERS
+ (
+ SCHED_NAME VARCHAR(120) NOT NULL,
+ TRIGGER_NAME VARCHAR(200) NOT NULL,
+ TRIGGER_GROUP VARCHAR(200) NOT NULL,
+ CRON_EXPRESSION VARCHAR(200) NOT NULL,
+ TIME_ZONE_ID VARCHAR(80),
+ PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
+ FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
+ REFERENCES XXL_JOB_QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
+);
+
+CREATE TABLE XXL_JOB_QRTZ_SIMPROP_TRIGGERS
+ (
+ SCHED_NAME VARCHAR(120) NOT NULL,
+ TRIGGER_NAME VARCHAR(200) NOT NULL,
+ TRIGGER_GROUP VARCHAR(200) NOT NULL,
+ STR_PROP_1 VARCHAR(512) NULL,
+ STR_PROP_2 VARCHAR(512) NULL,
+ STR_PROP_3 VARCHAR(512) NULL,
+ INT_PROP_1 INT NULL,
+ INT_PROP_2 INT NULL,
+ LONG_PROP_1 BIGINT NULL,
+ LONG_PROP_2 BIGINT NULL,
+ DEC_PROP_1 NUMERIC(13,4) NULL,
+ DEC_PROP_2 NUMERIC(13,4) NULL,
+ BOOL_PROP_1 VARCHAR(1) NULL,
+ BOOL_PROP_2 VARCHAR(1) NULL,
+ PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
+ FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
+ REFERENCES XXL_JOB_QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
+);
+
+CREATE TABLE XXL_JOB_QRTZ_BLOB_TRIGGERS
+ (
+ SCHED_NAME VARCHAR(120) NOT NULL,
+ TRIGGER_NAME VARCHAR(200) NOT NULL,
+ TRIGGER_GROUP VARCHAR(200) NOT NULL,
+ BLOB_DATA BLOB NULL,
+ PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
+ FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
+ REFERENCES XXL_JOB_QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
+);
+
+CREATE TABLE XXL_JOB_QRTZ_CALENDARS
+ (
+ SCHED_NAME VARCHAR(120) NOT NULL,
+ CALENDAR_NAME VARCHAR(200) NOT NULL,
+ CALENDAR BLOB NOT NULL,
+ PRIMARY KEY (SCHED_NAME,CALENDAR_NAME)
+);
+
+CREATE TABLE XXL_JOB_QRTZ_PAUSED_TRIGGER_GRPS
+ (
+ SCHED_NAME VARCHAR(120) NOT NULL,
+ TRIGGER_GROUP VARCHAR(200) NOT NULL,
+ PRIMARY KEY (SCHED_NAME,TRIGGER_GROUP)
+);
+
+CREATE TABLE XXL_JOB_QRTZ_FIRED_TRIGGERS
+ (
+ SCHED_NAME VARCHAR(120) NOT NULL,
+ ENTRY_ID VARCHAR(95) NOT NULL,
+ TRIGGER_NAME VARCHAR(200) NOT NULL,
+ TRIGGER_GROUP VARCHAR(200) NOT NULL,
+ INSTANCE_NAME VARCHAR(200) NOT NULL,
+ FIRED_TIME BIGINT(13) NOT NULL,
+ SCHED_TIME BIGINT(13) NOT NULL,
+ PRIORITY INTEGER NOT NULL,
+ STATE VARCHAR(16) NOT NULL,
+ JOB_NAME VARCHAR(200) NULL,
+ JOB_GROUP VARCHAR(200) NULL,
+ IS_NONCONCURRENT VARCHAR(1) NULL,
+ REQUESTS_RECOVERY VARCHAR(1) NULL,
+ PRIMARY KEY (SCHED_NAME,ENTRY_ID)
+);
+
+CREATE TABLE XXL_JOB_QRTZ_SCHEDULER_STATE
+ (
+ SCHED_NAME VARCHAR(120) NOT NULL,
+ INSTANCE_NAME VARCHAR(200) NOT NULL,
+ LAST_CHECKIN_TIME BIGINT(13) NOT NULL,
+ CHECKIN_INTERVAL BIGINT(13) NOT NULL,
+ PRIMARY KEY (SCHED_NAME,INSTANCE_NAME)
+);
+
+CREATE TABLE XXL_JOB_QRTZ_LOCKS
+ (
+ SCHED_NAME VARCHAR(120) NOT NULL,
+ LOCK_NAME VARCHAR(40) NOT NULL,
+ PRIMARY KEY (SCHED_NAME,LOCK_NAME)
+);
+
+
+
+CREATE TABLE `XXL_JOB_QRTZ_TRIGGER_INFO` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `job_group` int(11) NOT NULL COMMENT '执行器主键ID',
+ `job_cron` varchar(128) NOT NULL COMMENT '任务执行CRON',
+ `job_desc` varchar(255) NOT NULL,
+ `add_time` datetime DEFAULT NULL,
+ `update_time` datetime DEFAULT NULL,
+ `author` varchar(64) DEFAULT NULL COMMENT '作者',
+ `alarm_email` varchar(255) DEFAULT NULL COMMENT '报警邮件',
+ `executor_route_strategy` varchar(50) DEFAULT NULL COMMENT '执行器路由策略',
+ `executor_handler` varchar(255) DEFAULT NULL COMMENT '执行器任务handler',
+ `executor_param` varchar(255) DEFAULT NULL COMMENT '执行器任务参数',
+ `executor_block_strategy` varchar(50) DEFAULT NULL COMMENT '阻塞处理策略',
+ `executor_fail_strategy` varchar(50) DEFAULT NULL COMMENT '失败处理策略',
+ `glue_type` varchar(50) NOT NULL COMMENT 'GLUE类型',
+ `glue_source` text COMMENT 'GLUE源代码',
+ `glue_remark` varchar(128) DEFAULT NULL COMMENT 'GLUE备注',
+ `glue_updatetime` datetime DEFAULT NULL COMMENT 'GLUE更新时间',
+ `child_jobkey` varchar(255) DEFAULT NULL COMMENT '子任务Key',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE `XXL_JOB_QRTZ_TRIGGER_LOG` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `job_group` int(11) NOT NULL COMMENT '执行器主键ID',
+ `job_id` int(11) NOT NULL COMMENT '任务,主键ID',
+ `glue_type` varchar(50) DEFAULT NULL COMMENT 'GLUE类型',
+ `executor_address` varchar(255) DEFAULT NULL COMMENT '执行器地址,本次执行的地址',
+ `executor_handler` varchar(255) DEFAULT NULL COMMENT '执行器任务handler',
+ `executor_param` varchar(255) DEFAULT NULL COMMENT 'executor_param',
+ `trigger_time` datetime DEFAULT NULL COMMENT '调度-时间',
+ `trigger_code` varchar(255) NOT NULL DEFAULT '0' COMMENT '调度-结果',
+ `trigger_msg` varchar(2048) DEFAULT NULL COMMENT '调度-日志',
+ `handle_time` datetime DEFAULT NULL COMMENT '执行-时间',
+ `handle_code` varchar(255) NOT NULL DEFAULT '0' COMMENT '执行-状态',
+ `handle_msg` varchar(2048) DEFAULT NULL COMMENT '执行-日志',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE `XXL_JOB_QRTZ_TRIGGER_LOGGLUE` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `job_id` int(11) NOT NULL COMMENT '任务,主键ID',
+ `glue_type` varchar(50) DEFAULT NULL COMMENT 'GLUE类型',
+ `glue_source` text COMMENT 'GLUE源代码',
+ `glue_remark` varchar(128) NOT NULL COMMENT 'GLUE备注',
+ `add_time` timestamp NULL DEFAULT NULL,
+ `update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE XXL_JOB_QRTZ_TRIGGER_REGISTRY (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `registry_group` varchar(255) NOT NULL,
+ `registry_key` varchar(255) NOT NULL,
+ `registry_value` varchar(255) NOT NULL,
+ `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE `XXL_JOB_QRTZ_TRIGGER_GROUP` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `app_name` varchar(64) NOT NULL COMMENT '执行器AppName',
+ `title` varchar(12) NOT NULL COMMENT '执行器名称',
+ `order` tinyint(4) NOT NULL DEFAULT '0' COMMENT '排序',
+ `address_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '执行器地址类型:0=自动注册、1=手动录入',
+ `address_list` varchar(200) DEFAULT NULL COMMENT '执行器地址列表,多地址逗号分隔',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+INSERT INTO `XXL_JOB_QRTZ_TRIGGER_GROUP` ( `app_name`, `title`, `order`, `address_type`, `address_list`) values ( 'xxl-job-executor-sample', '示例执行器', '1', '0', null);
+
+commit;
+
diff --git a/pom.xml b/pom.xml
index 2d4a3f66..3d6fd31d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,8 +13,7 @@
xxl-job-core
xxl-job-admin
- xxl-job-executor-example
- xxl-job-executor-springboot-example
+ xxl-job-executor-samples
diff --git a/xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java b/xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java
index 1d5cb849..377d8b3f 100644
--- a/xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java
+++ b/xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java
@@ -71,7 +71,9 @@ public class XxlJobExecutor implements ApplicationContextAware {
initAdminBizList(adminAddresses, accessToken);
// init executor-jobHandlerRepository
- initJobHandlerRepository(applicationContext);
+ if (applicationContext != null) {
+ initJobHandlerRepository(applicationContext);
+ }
// init logpath
if (logPath!=null && logPath.trim().length()>0) {
diff --git a/xxl-job-core/src/main/java/com/xxl/job/core/log/XxlJobFileAppender.java b/xxl-job-core/src/main/java/com/xxl/job/core/log/XxlJobFileAppender.java
index bd210256..27b942be 100644
--- a/xxl-job-core/src/main/java/com/xxl/job/core/log/XxlJobFileAppender.java
+++ b/xxl-job-core/src/main/java/com/xxl/job/core/log/XxlJobFileAppender.java
@@ -18,7 +18,7 @@ public class XxlJobFileAppender {
// for JobThread (support log for child thread of job handler)
//public static ThreadLocal contextHolder = new ThreadLocal();
public static final InheritableThreadLocal contextHolder = new InheritableThreadLocal();
- public static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+ public static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // TODO, concurrent issues
public static String logPath = "/data/applogs/xxl-job/jobhandler/";
/**
diff --git a/xxl-job-executor-samples/pom.xml b/xxl-job-executor-samples/pom.xml
new file mode 100644
index 00000000..2f5386c9
--- /dev/null
+++ b/xxl-job-executor-samples/pom.xml
@@ -0,0 +1,18 @@
+
+
+ 4.0.0
+
+ com.xuxueli
+ xxl-job
+ 1.8.2-SNAPSHOT
+
+ xxl-job-executor-samples
+ pom
+
+
+ xxl-job-executor-sample-spring
+ xxl-job-executor-sample-springboot
+
+
+
\ No newline at end of file
diff --git a/xxl-job-executor-example/pom.xml b/xxl-job-executor-samples/xxl-job-executor-sample-spring/pom.xml
similarity index 88%
rename from xxl-job-executor-example/pom.xml
rename to xxl-job-executor-samples/xxl-job-executor-sample-spring/pom.xml
index 536d31a3..c7ef26fe 100644
--- a/xxl-job-executor-example/pom.xml
+++ b/xxl-job-executor-samples/xxl-job-executor-sample-spring/pom.xml
@@ -1,39 +1,39 @@
-
- 4.0.0
-
- com.xuxueli
- xxl-job
- 1.8.2-SNAPSHOT
-
- xxl-job-executor-example
- war
-
- ${project.artifactId}
- Executor project for spring boot.
- http://www.xuxueli.com/
-
-
-
-
- org.springframework
- spring-webmvc
- ${spring.version}
-
-
-
-
- org.slf4j
- slf4j-log4j12
- ${slf4j-api.version}
-
-
-
-
- com.xuxueli
- xxl-job-core
- ${project.parent.version}
-
-
-
+
+ 4.0.0
+
+ com.xuxueli
+ xxl-job-executor-samples
+ 1.8.2-SNAPSHOT
+
+ xxl-job-executor-sample-spring
+ war
+
+ ${project.artifactId}
+ Executor project for spring boot.
+ http://www.xuxueli.com/
+
+
+
+
+ org.springframework
+ spring-webmvc
+ ${spring.version}
+
+
+
+
+ org.slf4j
+ slf4j-log4j12
+ ${slf4j-api.version}
+
+
+
+
+ com.xuxueli
+ xxl-job-core
+ ${project.parent.version}
+
+
+
\ No newline at end of file
diff --git a/xxl-job-executor-example/src/main/java/com/xxl/job/executor/service/jobhandler/DemoJobHandler.java b/xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/java/com/xxl/job/executor/service/jobhandler/DemoJobHandler.java
similarity index 97%
rename from xxl-job-executor-example/src/main/java/com/xxl/job/executor/service/jobhandler/DemoJobHandler.java
rename to xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/java/com/xxl/job/executor/service/jobhandler/DemoJobHandler.java
index f9a2f605..905a0b7b 100644
--- a/xxl-job-executor-example/src/main/java/com/xxl/job/executor/service/jobhandler/DemoJobHandler.java
+++ b/xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/java/com/xxl/job/executor/service/jobhandler/DemoJobHandler.java
@@ -1,38 +1,38 @@
-package com.xxl.job.executor.service.jobhandler;
-
-import com.xxl.job.core.biz.model.ReturnT;
-import com.xxl.job.core.handler.IJobHandler;
-import com.xxl.job.core.handler.annotation.JobHander;
-import com.xxl.job.core.log.XxlJobLogger;
-import org.springframework.stereotype.Component;
-
-import java.util.concurrent.TimeUnit;
-
-
-/**
- * 任务Handler的一个Demo(Bean模式)
- *
- * 开发步骤:
- * 1、新建一个继承com.xxl.job.core.handler.IJobHandler的Java类;
- * 2、该类被Spring容器扫描为Bean实例,如加“@Component”注解;
- * 3、添加 “@JobHander(value="自定义jobhandler名称")”注解,注解的value值为自定义的JobHandler名称,该名称对应的是调度中心新建任务的JobHandler属性的值。
- * 4、执行日志:需要通过 "XxlJobLogger.log" 打印执行日志;
- *
- * @author xuxueli 2015-12-19 19:43:36
- */
-@JobHander(value="demoJobHandler")
-@Component
-public class DemoJobHandler extends IJobHandler {
-
- @Override
- public ReturnT execute(String... params) 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;
- }
-
-}
+package com.xxl.job.executor.service.jobhandler;
+
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.handler.IJobHandler;
+import com.xxl.job.core.handler.annotation.JobHander;
+import com.xxl.job.core.log.XxlJobLogger;
+import org.springframework.stereotype.Component;
+
+import java.util.concurrent.TimeUnit;
+
+
+/**
+ * 任务Handler的一个Demo(Bean模式)
+ *
+ * 开发步骤:
+ * 1、新建一个继承com.xxl.job.core.handler.IJobHandler的Java类;
+ * 2、该类被Spring容器扫描为Bean实例,如加“@Component”注解;
+ * 3、添加 “@JobHander(value="自定义jobhandler名称")”注解,注解的value值为自定义的JobHandler名称,该名称对应的是调度中心新建任务的JobHandler属性的值。
+ * 4、执行日志:需要通过 "XxlJobLogger.log" 打印执行日志;
+ *
+ * @author xuxueli 2015-12-19 19:43:36
+ */
+@JobHander(value="demoJobHandler")
+@Component
+public class DemoJobHandler extends IJobHandler {
+
+ @Override
+ public ReturnT execute(String... params) 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;
+ }
+
+}
diff --git a/xxl-job-executor-example/src/main/java/com/xxl/job/executor/service/jobhandler/ShardingJobHandler.java b/xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/java/com/xxl/job/executor/service/jobhandler/ShardingJobHandler.java
similarity index 100%
rename from xxl-job-executor-example/src/main/java/com/xxl/job/executor/service/jobhandler/ShardingJobHandler.java
rename to xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/java/com/xxl/job/executor/service/jobhandler/ShardingJobHandler.java
diff --git a/xxl-job-executor-example/src/main/resources/applicationcontext-xxl-job.xml b/xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/resources/applicationcontext-xxl-job.xml
similarity index 97%
rename from xxl-job-executor-example/src/main/resources/applicationcontext-xxl-job.xml
rename to xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/resources/applicationcontext-xxl-job.xml
index be84182c..9a96a4d8 100644
--- a/xxl-job-executor-example/src/main/resources/applicationcontext-xxl-job.xml
+++ b/xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/resources/applicationcontext-xxl-job.xml
@@ -1,41 +1,41 @@
-
-
-
-
-
-
-
- classpath*:xxl-job-executor.properties
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ classpath*:xxl-job-executor.properties
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/xxl-job-executor-example/src/main/resources/log4j.xml b/xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/resources/log4j.xml
similarity index 85%
rename from xxl-job-executor-example/src/main/resources/log4j.xml
rename to xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/resources/log4j.xml
index cd593b86..f0a7fc65 100644
--- a/xxl-job-executor-example/src/main/resources/log4j.xml
+++ b/xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/resources/log4j.xml
@@ -5,16 +5,16 @@
-
+
-
+
-
+
diff --git a/xxl-job-executor-example/src/main/resources/xxl-job-executor.properties b/xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/resources/xxl-job-executor.properties
similarity index 83%
rename from xxl-job-executor-example/src/main/resources/xxl-job-executor.properties
rename to xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/resources/xxl-job-executor.properties
index 7aa2da13..ab71b92b 100644
--- a/xxl-job-executor-example/src/main/resources/xxl-job-executor.properties
+++ b/xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/resources/xxl-job-executor.properties
@@ -2,7 +2,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-example
+xxl.job.executor.appname=xxl-job-executor-sample
xxl.job.executor.ip=
xxl.job.executor.port=9999
diff --git a/xxl-job-executor-example/src/main/webapp/WEB-INF/web.xml b/xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/webapp/WEB-INF/web.xml
similarity index 90%
rename from xxl-job-executor-example/src/main/webapp/WEB-INF/web.xml
rename to xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/webapp/WEB-INF/web.xml
index e4bb36b8..7091fff4 100644
--- a/xxl-job-executor-example/src/main/webapp/WEB-INF/web.xml
+++ b/xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/webapp/WEB-INF/web.xml
@@ -1,27 +1,27 @@
-
-
-
- webAppRootKey
- xxl-job-client-demo
-
-
-
- contextConfigLocation
- classpath*:applicationcontext-*.xml
-
-
-
- org.springframework.web.util.Log4jConfigListener
-
-
- org.springframework.web.context.ContextLoaderListener
-
-
-
- index.html
-
-
+
+
+
+ webAppRootKey
+ xxl-job-executor-sample-spring
+
+
+
+ contextConfigLocation
+ classpath*:applicationcontext-*.xml
+
+
+
+ org.springframework.web.util.Log4jConfigListener
+
+
+ org.springframework.web.context.ContextLoaderListener
+
+
+
+ index.html
+
+
\ No newline at end of file
diff --git a/xxl-job-executor-example/src/main/webapp/index.html b/xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/webapp/index.html
similarity index 100%
rename from xxl-job-executor-example/src/main/webapp/index.html
rename to xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/webapp/index.html
diff --git a/xxl-job-executor-example/src/test/java/com/xxl/executor/test/DemoJobHandlerTest.java b/xxl-job-executor-samples/xxl-job-executor-sample-spring/src/test/java/com/xxl/executor/test/DemoJobHandlerTest.java
similarity index 100%
rename from xxl-job-executor-example/src/test/java/com/xxl/executor/test/DemoJobHandlerTest.java
rename to xxl-job-executor-samples/xxl-job-executor-sample-spring/src/test/java/com/xxl/executor/test/DemoJobHandlerTest.java
diff --git a/xxl-job-executor-springboot-example/pom.xml b/xxl-job-executor-samples/xxl-job-executor-sample-springboot/pom.xml
similarity index 96%
rename from xxl-job-executor-springboot-example/pom.xml
rename to xxl-job-executor-samples/xxl-job-executor-sample-springboot/pom.xml
index b09f38ac..d4d85330 100644
--- a/xxl-job-executor-springboot-example/pom.xml
+++ b/xxl-job-executor-samples/xxl-job-executor-sample-springboot/pom.xml
@@ -5,10 +5,10 @@
4.0.0
com.xuxueli
- xxl-job
+ xxl-job-executor-samples
1.8.2-SNAPSHOT
- xxl-job-executor-springboot-example
+ xxl-job-executor-sample-springboot
jar
${project.artifactId}
diff --git a/xxl-job-executor-springboot-example/src/main/java/com/xxl/job/executor/Application.java b/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/Application.java
similarity index 100%
rename from xxl-job-executor-springboot-example/src/main/java/com/xxl/job/executor/Application.java
rename to xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/Application.java
diff --git a/xxl-job-executor-springboot-example/src/main/java/com/xxl/job/executor/core/config/XxlJobConfig.java b/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/core/config/XxlJobConfig.java
similarity index 100%
rename from xxl-job-executor-springboot-example/src/main/java/com/xxl/job/executor/core/config/XxlJobConfig.java
rename to xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/core/config/XxlJobConfig.java
diff --git a/xxl-job-executor-springboot-example/src/main/java/com/xxl/job/executor/mvc/controller/IndexController.java b/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/mvc/controller/IndexController.java
similarity index 100%
rename from xxl-job-executor-springboot-example/src/main/java/com/xxl/job/executor/mvc/controller/IndexController.java
rename to xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/mvc/controller/IndexController.java
diff --git a/xxl-job-executor-springboot-example/src/main/java/com/xxl/job/executor/service/jobhandler/DemoJobHandler.java b/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/service/jobhandler/DemoJobHandler.java
similarity index 100%
rename from xxl-job-executor-springboot-example/src/main/java/com/xxl/job/executor/service/jobhandler/DemoJobHandler.java
rename to xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/service/jobhandler/DemoJobHandler.java
diff --git a/xxl-job-executor-springboot-example/src/main/java/com/xxl/job/executor/service/jobhandler/ShardingJobHandler.java b/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/service/jobhandler/ShardingJobHandler.java
similarity index 100%
rename from xxl-job-executor-springboot-example/src/main/java/com/xxl/job/executor/service/jobhandler/ShardingJobHandler.java
rename to xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/service/jobhandler/ShardingJobHandler.java
diff --git a/xxl-job-executor-springboot-example/src/main/resources/application.properties b/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/application.properties
similarity index 90%
rename from xxl-job-executor-springboot-example/src/main/resources/application.properties
rename to xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/application.properties
index e6a6c1d9..497c4299 100644
--- a/xxl-job-executor-springboot-example/src/main/resources/application.properties
+++ b/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/application.properties
@@ -9,7 +9,7 @@ logging.config=classpath:logback.xml
xxl.job.admin.addresses=http://127.0.0.1:8080/xxl-job-admin
### xxl-job executor address
-xxl.job.executor.appname=xxl-job-executor-example
+xxl.job.executor.appname=xxl-job-executor-sample
xxl.job.executor.ip=
xxl.job.executor.port=9998
diff --git a/xxl-job-executor-springboot-example/src/main/resources/logback.xml b/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/logback.xml
similarity index 96%
rename from xxl-job-executor-springboot-example/src/main/resources/logback.xml
rename to xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/logback.xml
index 3eeb2f05..bbea067c 100644
--- a/xxl-job-executor-springboot-example/src/main/resources/logback.xml
+++ b/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/logback.xml
@@ -2,7 +2,7 @@
logback
-
+