Merge remote-tracking branch 'origin/master'

pull/4/head
xuxueli 7 years ago
commit e02e4863da

@ -347,7 +347,7 @@ On the log console,you can view task execution log on the executor immediately a
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.
GLUE模式(Shell)its source code is a shell script and maintained in the schedule center.
GLUE模式(Python)its source code is a python script and maintained in the schedule center.
- JobHandlerits used in "BEAN模式",its instance is defined by annotation @JobHander on the JobHandler class name.
- JobHandlerits used in "BEAN模式",its instance is defined by annotation @JobHandler on the JobHandler class name.
- 子任务Keyevery task has a unique key (task Key can acquire from task list)when main task is done successfully its child task stand for by this key will be scheduled.
- 阻塞处理策略the stategy handle the task when this task is scheduled too frequently and the task is block to wait for cpu time.
单机串行默认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
#### Step 1:develp obHandler in the executor project
- 1, create new java class implent com.xxl.job.core.handler.IJobHandler;
- 2, if you add @Component annotation on the top of the class name its will be managed as a bean instance by spring container;
- 3, add “@JobHander(value=" customize jobhandler name")” annotationthe value stand for JobHandler name,it will be used as JobHandler property when create a new task in the schedule center.
- 3, add “@JobHandler(value=" customize jobhandler name")” annotationthe value stand for JobHandler name,it will be used as JobHandler property when create a new task in the schedule center.
go and see DemoJobHandler in the xxl-job-executor-example project, as shown below
![输入图片说明](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
### 5.5 Task "run mode" analysis
#### 5.5.1 "Bean模式" task
Development steps:go and see "chapter 3" .
principle: every Bean mode task is a Spring Bean instance and it is maintained in executor projects 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.
principle: every Bean mode task is a Spring Bean instance and it is maintained in executor projects 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.
#### 5.5.2 "GLUE模式(Java)" task
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
![输入图片说明](https://static.oschina.net/uploads/img/201703/10174923_TgNO.png "在这里输入图片标题")
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.
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.
When executor received schedule request from schedule center, if task type is “Bean模式” it will match bean mode task in Spring container and call its execute() method and execute task logic. if task type is “GLUE模式”, it will load Glue code, instantiate a Java object and inject other spring servicenotice: the spring service injected in Glue code must exist in the same executor project, then call execute() method and execute task logic.
@ -810,13 +810,13 @@ The scheduling center API service requests reference codecom.xxl.job.dao.impl
- stability;
### 6.3 version V1.3.0New features [2016-05-19]
- 1、discard local task module, remote task was recommended, easy to decouple system, the JobHander of task was called executor.
- 1、discard local task module, remote task was recommended, easy to decouple system, the JobHandler of task was called executor.
- 2、dicard underlying communication type servlet, JETTY was recommended, schedule and callback bidirectional communication, rebuild the communication logic;
- 3、UI interactive optimization:optimize left menu expansion and menu item selected status , task list opens the table with compression optimization;
- 4、【important】executor is subdivided into two develop mode:BEAN、GLUE:
Introduction to the executor mode:
- BEAN mode executor:every executor is a Spring Bean instanceit was recognized and scheduled by XXL-JOB through @JobHander annotation;
- BEAN mode executor:every executor is a Spring Bean instanceit was recognized and scheduled by XXL-JOB through @JobHandler annotation;
-GLUE mode executor:every executor corresponds to a piece of codeedited and maintained online by Web, Dynamic compile and takes effect in real time, executor is responsible for loading GLUE code and executing;
### 6.4 version V1.3.1New features [2016-05-23]

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

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

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

@ -2,7 +2,7 @@ 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.handler.annotation.JobHandler;
import com.xxl.job.core.log.XxlJobLogger;
import org.springframework.stereotype.Component;
@ -15,12 +15,12 @@ import java.util.concurrent.TimeUnit;
*
* 1com.xxl.job.core.handler.IJobHandlerJava
* 2SpringBean@Component
* 3 @JobHander(value="自定义jobhandler名称")valueJobHandlerJobHandler
* 3 @JobHandler(value="自定义jobhandler名称")valueJobHandlerJobHandler
* 4 "XxlJobLogger.log"
*
* @author xuxueli 2015-12-19 19:43:36
*/
@JobHander(value="demoJobHandler")
@JobHandler(value="demoJobHandler")
@Component
public class DemoJobHandler extends IJobHandler {

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

@ -2,7 +2,7 @@ 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.handler.annotation.JobHandler;
import com.xxl.job.core.log.XxlJobLogger;
import org.springframework.stereotype.Service;
@ -15,12 +15,12 @@ import java.util.concurrent.TimeUnit;
*
* 1 IJobHandler
* 2Spring @Service
* 3 @JobHander valueJobKey;JobKey;
* 3 @JobHandler valueJobKey;JobKey;
* 4 "XxlJobLogger.log"
*
* @author xuxueli 2015-12-19 19:43:36
*/
@JobHander(value="demoJobHandler")
@JobHandler(value="demoJobHandler")
@Service
public class DemoJobHandler extends IJobHandler {

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

Loading…
Cancel
Save