Ver código fonte

Merge remote-tracking branch 'origin/master'

xuxueli 7 anos atrás
pai
commit
e02e4863da

+ 6 - 6
doc/XXL-JOB-English-Documentation.md Ver arquivo

@@ -347,7 +347,7 @@ On the log console,you can view task execution log on the executor immediately a
347 347
         GLUE模式(Java):task source code is maintened in the schedule center,it must implement IJobHandler and explain by "groovy" in the executor instance,inject other bean instace by annotation @Resource/@Autowire.
348 348
         GLUE模式(Shell):it’s source code is a shell script and maintained in the schedule center.
349 349
         GLUE模式(Python):it’s source code is a python script and maintained in the schedule center.
350
-    - JobHandler:it’s used in  "BEAN模式",it’s instance is defined by annotation @JobHander on the JobHandler class name.
350
+    - JobHandler:it’s used in  "BEAN模式",it’s instance is defined by annotation @JobHandler on the JobHandler class name.
351 351
     - 子任务Key:every task has a unique key (task Key can acquire from task list),when main task is done successfully it’s child task stand for by this key will be scheduled.
352 352
     - 阻塞处理策略:the stategy handle the task when this task is scheduled too frequently and the task is block to wait for cpu time.
353 353
         单机串行(默认):task schedule request go into the FIFO queue and execute serially.
@@ -366,7 +366,7 @@ The task logic exist in the executor project as JobHandler,the develop steps as
366 366
 #### Step 1:develp obHandler in the executor project
367 367
     - 1, create new java class implent com.xxl.job.core.handler.IJobHandler;
368 368
     - 2, if you add @Component annotation on the top of the class name it’s will be managed as a bean instance by spring container;
369
-    - 3, add  “@JobHander(value=" customize jobhandler name")” annotation,the value stand for JobHandler name,it will be used as JobHandler property when create a new task in the schedule center.
369
+    - 3, add  “@JobHandler(value=" customize jobhandler name")” annotation,the value stand for JobHandler name,it will be used as JobHandler property when create a new task in the schedule center.
370 370
     (go and see DemoJobHandler in the xxl-job-executor-example project, as shown below)
371 371
 
372 372
 ![输入图片说明](https://static.oschina.net/uploads/img/201607/23232347_oLlM.png "在这里输入图片标题")
@@ -682,7 +682,7 @@ On the task log page ,you can see matched child task and triggered child task’
682 682
 ### 5.5 Task "run mode" analysis
683 683
 #### 5.5.1 "Bean模式" task
684 684
 Development steps:go and see "chapter 3" . 
685
-principle: every Bean mode task is a Spring Bean instance and it is maintained in executor project’s Spring container. task class nedd to add “@JobHander(value="name")” annotation, because executor identify task bean instance in spring container through annotation. Task class nedd to implements interface IJobHandler, task logic code in method execute(), the task logic in execute() method will be executed when executor received a schedule request from schedule center.
685
+principle: every Bean mode task is a Spring Bean instance and it is maintained in executor project’s Spring container. task class nedd to add “@JobHandler(value="name")” annotation, because executor identify task bean instance in spring container through annotation. Task class nedd to implements interface IJobHandler, task logic code in method execute(), the task logic in execute() method will be executed when executor received a schedule request from schedule center.
686 686
 
687 687
 #### 5.5.2 "GLUE模式(Java)" task
688 688
 Development steps:go and see "chapter 3" .
@@ -703,7 +703,7 @@ Executor is actually an embedded Jetty server with default port 9999, as shown b
703 703
 
704 704
 ![输入图片说明](https://static.oschina.net/uploads/img/201703/10174923_TgNO.png "在这里输入图片标题")
705 705
 
706
-Executor will identify Bean mode task in spring container through @JobHander When project start, it will be managed use the value of annotation as key. 
706
+Executor will identify Bean mode task in spring container through @JobHandler When project start, it will be managed use the value of annotation as key. 
707 707
 
708 708
 When executor received schedule request from schedule center, if task type is “Bean模式” it will match bean mode task in Spring container and call it’s execute() method and execute task logic. if task type is “GLUE模式”, it will load Glue code, instantiate a Java object and inject other spring service(notice: the spring service injected in Glue code must exist in the same executor project), then call execute() method and execute task logic. 
709 709
 
@@ -810,13 +810,13 @@ The scheduling center API service requests reference code:com.xxl.job.dao.impl
810 810
 		- stability;
811 811
 
812 812
 ### 6.3 version V1.3.0,New features [2016-05-19]
813
-- 1、discard local task module, remote task was recommended, easy to decouple system, the JobHander of task was called executor.
813
+- 1、discard local task module, remote task was recommended, easy to decouple system, the JobHandler of task was called executor.
814 814
 - 2、dicard underlying communication type servlet, JETTY was recommended, schedule and callback bidirectional communication, rebuild the communication logic;
815 815
 - 3、UI interactive optimization:optimize left menu expansion and menu item selected status , task list opens the table with compression optimization;
816 816
 - 4、【important】executor is subdivided into two develop mode:BEAN、GLUE:
817 817
 	
818 818
 	Introduction to the executor mode:
819
-		- BEAN mode executor:every executor is a Spring Bean instance,it was recognized and scheduled by XXL-JOB through @JobHander annotation;
819
+		- BEAN mode executor:every executor is a Spring Bean instance,it was recognized and scheduled by XXL-JOB through @JobHandler annotation;
820 820
 		 -GLUE mode executor:every executor corresponds to a piece of code,edited and maintained online by Web, Dynamic compile and takes effect in real time, executor is responsible for loading GLUE code and executing;
821 821
 
822 822
 ### 6.4 version V1.3.1,New features [2016-05-23]

+ 8 - 7
doc/XXL-JOB官方文档.md Ver arquivo

@@ -359,7 +359,7 @@ XXL-JOB是一个轻量级分布式任务调度框架,其核心设计目标是
359 359
         GLUE模式(Shell):任务以源码方式维护在调度中心;该模式的任务实际上是一段 "shell" 脚本;
360 360
         GLUE模式(Python):任务以源码方式维护在调度中心;该模式的任务实际上是一段 "python" 脚本;
361 361
         GLUE模式(NodeJS):任务以源码方式维护在调度中心;该模式的任务实际上是一段 "nodejs" 脚本;
362
-    - JobHandler:运行模式为 "BEAN模式" 时生效,对应执行器中新开发的JobHandler类“@JobHander”注解自定义的value值;
362
+    - JobHandler:运行模式为 "BEAN模式" 时生效,对应执行器中新开发的JobHandler类“@JobHandler”注解自定义的value值;
363 363
     - 子任务Key:每个任务都拥有一个唯一的任务Key(任务Key可以从任务列表获取),当本任务执行结束并且执行成功时,将会触发子任务Key所对应的任务的一次主动调度。
364 364
     - 阻塞处理策略:调度过于密集执行器来不及处理时的处理策略;
365 365
         单机串行(默认):调度请求进入单机执行器后,调度请求进入FIFO队列并以串行方式运行;
@@ -378,13 +378,13 @@ XXL-JOB是一个轻量级分布式任务调度框架,其核心设计目标是
378 378
 #### 步骤一:执行器项目中,开发JobHandler:
379 379
     - 1、 新建一个继承com.xxl.job.core.handler.IJobHandler的Java类;
380 380
     - 2、 该类被Spring容器扫描为Bean实例,如加“@Component”注解;
381
-    - 3、 添加 “@JobHander(value="自定义jobhandler名称")”注解,注解的value值为自定义的JobHandler名称,该名称对应的是调度中心新建任务的JobHandler属性的值。
381
+    - 3、 添加 “@JobHandler(value="自定义jobhandler名称")”注解,注解的value值为自定义的JobHandler名称,该名称对应的是调度中心新建任务的JobHandler属性的值。
382 382
     (可参考Sample示例执行器中的DemoJobHandler,见下图)
383 383
 
384 384
 ![输入图片说明](https://static.oschina.net/uploads/img/201607/23232347_oLlM.png "在这里输入图片标题")
385 385
 
386 386
 #### 步骤二:调度中心,新建调度任务
387
-参考上文“配置属性详细说明”对新建的任务进行参数配置,运行模式选中 "BEAN模式",JobHandler属性填写任务注解@JobHander中定义的值;
387
+参考上文“配置属性详细说明”对新建的任务进行参数配置,运行模式选中 "BEAN模式",JobHandler属性填写任务注解@JobHandler中定义的值;
388 388
 
389 389
 ![输入图片说明](https://static.oschina.net/uploads/img/201704/27225124_yrcO.png "在这里输入图片标题")
390 390
 
@@ -715,7 +715,7 @@ xxl-job-admin#com.xxl.job.admin.controller.JobApiController.callback
715 715
 ### 5.5 任务 "运行模式" 剖析
716 716
 #### 5.5.1 "Bean模式" 任务
717 717
 开发步骤:可参考 "章节三" ;
718
-原理:每个Bean模式任务都是一个Spring的Bean类实例,它被维护在“执行器”项目的Spring容器中。任务类需要加“@JobHander(value="名称")”注解,因为“执行器”会根据该注解识别Spring容器中的任务。任务类需要继承统一接口“IJobHandler”,任务逻辑在execute方法中开发,因为“执行器”在接收到调度中心的调度请求时,将会调用“IJobHandler”的execute方法,执行任务逻辑。
718
+原理:每个Bean模式任务都是一个Spring的Bean类实例,它被维护在“执行器”项目的Spring容器中。任务类需要加“@JobHandler(value="名称")”注解,因为“执行器”会根据该注解识别Spring容器中的任务。任务类需要继承统一接口“IJobHandler”,任务逻辑在execute方法中开发,因为“执行器”在接收到调度中心的调度请求时,将会调用“IJobHandler”的execute方法,执行任务逻辑。
719 719
 
720 720
 #### 5.5.2 "GLUE模式(Java)" 任务
721 721
 开发步骤:可参考 "章节三" ;
@@ -737,7 +737,7 @@ xxl-job-admin#com.xxl.job.admin.controller.JobApiController.callback
737 737
 
738 738
 ![输入图片说明](https://static.oschina.net/uploads/img/201703/10174923_TgNO.png "在这里输入图片标题")
739 739
 
740
-在项目启动时,执行器会通过“@JobHander”识别Spring容器中“Bean模式任务”,以注解的value属性为key管理起来。
740
+在项目启动时,执行器会通过“@JobHandler”识别Spring容器中“Bean模式任务”,以注解的value属性为key管理起来。
741 741
 
742 742
 “执行器”接收到“调度中心”的调度请求时,如果任务类型为“Bean模式”,将会匹配Spring容器中的“Bean模式任务”,然后调用其execute方法,执行任务逻辑。如果任务类型为“GLUE模式”,将会加载GLue代码,实例化Java对象,注入依赖的Spring服务(注意:Glue代码中注入的Spring服务,必须存在与该“执行器”项目的Spring容器中),然后调用execute方法,执行任务逻辑。
743 743
 
@@ -860,13 +860,13 @@ XXL-JOB会为每次调度请求生成一个单独的日志文件,需要通过
860 860
 		- 稳定性;
861 861
 
862 862
 ### 6.3 版本 V1.3.0,新特性[2016-05-19]
863
-- 1、遗弃“本地任务”模式,推荐使用“远程任务”,易于系统解耦,任务对应的JobHander统称为“执行器”;
863
+- 1、遗弃“本地任务”模式,推荐使用“远程任务”,易于系统解耦,任务对应的JobHandler统称为“执行器”;
864 864
 - 2、遗弃“servlet”方式底层系统通讯,推荐使用JETTY方式,调度+回调双向通讯,重构通讯逻辑;
865 865
 - 3、UI交互优化:左侧菜单展开状态优化,菜单项选中状态优化,任务列表打开表格有压缩优化;
866 866
 - 4、【重要】“执行器”细分为:BEAN、GLUE两种开发模式,简介见下文:
867 867
 	
868 868
 	“执行器” 模式简介:
869
-		- BEAN模式执行器:每个执行器都是Spring的一个Bean实例,XXL-JOB通过注解@JobHander识别和调度执行器;
869
+		- BEAN模式执行器:每个执行器都是Spring的一个Bean实例,XXL-JOB通过注解@JobHandler识别和调度执行器;
870 870
 		 -GLUE模式执行器:每个执行器对应一段代码,在线Web编辑和维护,动态编译生效,执行器负责加载GLUE代码和执行;
871 871
 
872 872
 ### 6.4 版本 V1.3.1,新特性[2016-05-23]
@@ -1052,6 +1052,7 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
1052 1052
 - 6、执行器动态代理对象,拦截非业务方法的执行;
1053 1053
 - 7、底层系统日志级别规范调整,清理遗留代码;
1054 1054
 - 8、修改JobThread捕获Error错误不更新JobLog的问题; 
1055
+- 9、任务注解调整为 “@JobHandler”,与任务注解统一;
1055 1056
 
1056 1057
 ### TODO LIST
1057 1058
 - 1、任务权限管理:执行器为粒度分配权限,核心操作校验权限;

+ 3 - 3
xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java Ver arquivo

@@ -4,7 +4,7 @@ import com.xxl.job.core.biz.AdminBiz;
4 4
 import com.xxl.job.core.biz.ExecutorBiz;
5 5
 import com.xxl.job.core.biz.impl.ExecutorBizImpl;
6 6
 import com.xxl.job.core.handler.IJobHandler;
7
-import com.xxl.job.core.handler.annotation.JobHander;
7
+import com.xxl.job.core.handler.annotation.JobHandler;
8 8
 import com.xxl.job.core.log.XxlJobFileAppender;
9 9
 import com.xxl.job.core.rpc.netcom.NetComClientProxy;
10 10
 import com.xxl.job.core.rpc.netcom.NetComServerFactory;
@@ -141,12 +141,12 @@ public class XxlJobExecutor implements ApplicationContextAware {
141 141
     }
142 142
     private static void initJobHandlerRepository(ApplicationContext applicationContext){
143 143
         // init job handler action
144
-        Map<String, Object> serviceBeanMap = applicationContext.getBeansWithAnnotation(JobHander.class);
144
+        Map<String, Object> serviceBeanMap = applicationContext.getBeansWithAnnotation(JobHandler.class);
145 145
 
146 146
         if (serviceBeanMap!=null && serviceBeanMap.size()>0) {
147 147
             for (Object serviceBean : serviceBeanMap.values()) {
148 148
                 if (serviceBean instanceof IJobHandler){
149
-                    String name = serviceBean.getClass().getAnnotation(JobHander.class).value();
149
+                    String name = serviceBean.getClass().getAnnotation(JobHandler.class).value();
150 150
                     IJobHandler handler = (IJobHandler) serviceBean;
151 151
                     if (loadJobHandler(name) != null) {
152 152
                         throw new RuntimeException("xxl-job jobhandler naming conflicts.");

xxl-job-core/src/main/java/com/xxl/job/core/handler/annotation/JobHander.java → xxl-job-core/src/main/java/com/xxl/job/core/handler/annotation/JobHandler.java Ver arquivo

@@ -13,7 +13,7 @@ import java.lang.annotation.Target;
13 13
 @Target({ElementType.TYPE})
14 14
 @Retention(RetentionPolicy.RUNTIME)
15 15
 @Inherited
16
-public @interface JobHander {
16
+public @interface JobHandler {
17 17
 
18 18
     String value() default "";
19 19
     

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

@@ -2,7 +2,7 @@ package com.xxl.job.executor.service.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.JobHander;
5
+import com.xxl.job.core.handler.annotation.JobHandler;
6 6
 import com.xxl.job.core.log.XxlJobLogger;
7 7
 import org.springframework.stereotype.Component;
8 8
 
@@ -15,12 +15,12 @@ import java.util.concurrent.TimeUnit;
15 15
  * 开发步骤:
16 16
  * 1、新建一个继承com.xxl.job.core.handler.IJobHandler的Java类;
17 17
  * 2、该类被Spring容器扫描为Bean实例,如加“@Component”注解;
18
- * 3、添加 “@JobHander(value="自定义jobhandler名称")”注解,注解的value值为自定义的JobHandler名称,该名称对应的是调度中心新建任务的JobHandler属性的值。
18
+ * 3、添加 “@JobHandler(value="自定义jobhandler名称")”注解,注解的value值为自定义的JobHandler名称,该名称对应的是调度中心新建任务的JobHandler属性的值。
19 19
  * 4、执行日志:需要通过 "XxlJobLogger.log" 打印执行日志;
20 20
  * 
21 21
  * @author xuxueli 2015-12-19 19:43:36
22 22
  */
23
-@JobHander(value="demoJobHandler")
23
+@JobHandler(value="demoJobHandler")
24 24
 @Component
25 25
 public class DemoJobHandler extends IJobHandler {
26 26
 

+ 2 - 2
xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/java/com/xxl/job/executor/service/jobhandler/ShardingJobHandler.java Ver arquivo

@@ -2,7 +2,7 @@ package com.xxl.job.executor.service.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.JobHander;
5
+import com.xxl.job.core.handler.annotation.JobHandler;
6 6
 import com.xxl.job.core.log.XxlJobLogger;
7 7
 import com.xxl.job.core.util.ShardingUtil;
8 8
 import org.springframework.stereotype.Service;
@@ -13,7 +13,7 @@ import org.springframework.stereotype.Service;
13 13
  *
14 14
  * @author xuxueli 2017-07-25 20:56:50
15 15
  */
16
-@JobHander(value="shardingJobHandler")
16
+@JobHandler(value="shardingJobHandler")
17 17
 @Service
18 18
 public class ShardingJobHandler extends IJobHandler {
19 19
 

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

@@ -2,7 +2,7 @@ package com.xxl.job.executor.service.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.JobHander;
5
+import com.xxl.job.core.handler.annotation.JobHandler;
6 6
 import com.xxl.job.core.log.XxlJobLogger;
7 7
 import org.springframework.stereotype.Service;
8 8
 
@@ -15,12 +15,12 @@ import java.util.concurrent.TimeUnit;
15 15
  * 开发步骤:
16 16
  * 1、继承 “IJobHandler” ;
17 17
  * 2、装配到Spring,例如加 “@Service” 注解;
18
- * 3、加 “@JobHander” 注解,注解value值为新增任务生成的JobKey的值;多个JobKey用逗号分割;
18
+ * 3、加 “@JobHandler” 注解,注解value值为新增任务生成的JobKey的值;多个JobKey用逗号分割;
19 19
  * 4、执行日志:需要通过 "XxlJobLogger.log" 打印执行日志;
20 20
  *
21 21
  * @author xuxueli 2015-12-19 19:43:36
22 22
  */
23
-@JobHander(value="demoJobHandler")
23
+@JobHandler(value="demoJobHandler")
24 24
 @Service
25 25
 public class DemoJobHandler extends IJobHandler {
26 26
 

+ 2 - 2
xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/service/jobhandler/ShardingJobHandler.java Ver arquivo

@@ -2,7 +2,7 @@ package com.xxl.job.executor.service.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.JobHander;
5
+import com.xxl.job.core.handler.annotation.JobHandler;
6 6
 import com.xxl.job.core.log.XxlJobLogger;
7 7
 import com.xxl.job.core.util.ShardingUtil;
8 8
 import org.springframework.stereotype.Service;
@@ -13,7 +13,7 @@ import org.springframework.stereotype.Service;
13 13
  *
14 14
  * @author xuxueli 2017-07-25 20:56:50
15 15
  */
16
-@JobHander(value="shardingJobHandler")
16
+@JobHandler(value="shardingJobHandler")
17 17
 @Service
18 18
 public class ShardingJobHandler extends IJobHandler {
19 19