新增“执行器启用开关”配置项(xxl.job.executor.enabled),默认开启,关闭时不进行执行器初始化;

3.3.1-release
xuxueli 8 months ago
parent cfd034643c
commit 2211110c33

@ -989,13 +989,13 @@ xuxueli/xxl-job-admin:{指定版本}
```
### 调度中心部署根地址 [选填]:如调度中心集群部署存在多个地址则用逗号分隔。执行器将会使用该地址进行"执行器心跳注册"和"任务结果回调";为空则关闭自动注册;
xxl.job.admin.addresses=http://127.0.0.1:8080/xxl-job-admin
### 调度中心通讯TOKEN [选填]:非空时启用;
xxl.job.admin.accessToken=default_token
### 调度中心通讯超时时间[选填]单位秒默认3s
xxl.job.admin.timeout=3
### 执行器启用开关 [选填]:默认开启,关闭时不进行执行器初始化;
xxl.job.executor.enabled=true
### 执行器AppName [选填]:执行器心跳注册分组依据;为空则关闭自动注册
xxl.job.executor.appname=xxl-job-executor-sample
### 执行器注册 [选填]:优先使用该配置作为注册地址,为空时使用内嵌服务 ”IP:PORT“ 作为注册地址。从而更灵活的支持容器类型执行器动态IP和动态映射端口问题。
@ -2700,7 +2700,7 @@ public void execute() {
### 7.42 版本 v3.3.1 Release Notes[ING]
- 1、【修复】调度组件事务代码优化修复DB超时等小概率情况下调度终止问题
- 2、【修复】合并PR-3869修复底层通讯超时设置无效问题
- 3、【TODO】执行器新增“执行器运行开关”配置项(xxl.job.executor.enable),关闭时执行器不进行初始化;
- 3、【新增】新增“执行器启用开关”配置项(xxl.job.executor.enabled),默认开启,关闭时不进行执行器初始化;
- 4、【TODO】任务调度触发后分批批量更新提升调度性能

@ -33,6 +33,7 @@ public class XxlJobExecutor {
private String adminAddresses;
private String accessToken;
private int timeout;
private Boolean enabled;
private String appname;
private String address;
private String ip;
@ -49,6 +50,9 @@ public class XxlJobExecutor {
public void setTimeout(int timeout) {
this.timeout = timeout;
}
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
public void setAppname(String appname) {
this.appname = appname;
}
@ -72,6 +76,12 @@ public class XxlJobExecutor {
// ---------------------- start + stop ----------------------
public void start() throws Exception {
// valid enabled
if (enabled!=null && !enabled) {
logger.info(">>>>>>>>>>> xxl-job executor start fail, enabled:{}", enabled);
return;
}
// init logpath
XxlJobFileAppender.initLogPath(logPath);

@ -49,7 +49,7 @@ public class XxlJobSimpleExecutor extends XxlJobExecutor {
private void initJobHandlerMethodRepository(List<Object> xxlJobBeanList) {
if (xxlJobBeanList==null || xxlJobBeanList.size()==0) {
if (xxlJobBeanList==null || xxlJobBeanList.isEmpty()) {
return;
}

@ -25,6 +25,9 @@ public class XxlJobConfig {
@Value("${xxl.job.admin.timeout}")
private int timeout;
@Value("${xxl.job.executor.enabled}")
private Boolean enabled;
@Value("${xxl.job.executor.appname}")
private String appname;
@ -49,12 +52,13 @@ public class XxlJobConfig {
logger.info(">>>>>>>>>>> xxl-job config init.");
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
xxlJobSpringExecutor.setAccessToken(accessToken);
xxlJobSpringExecutor.setTimeout(timeout);
xxlJobSpringExecutor.setEnabled(enabled);
xxlJobSpringExecutor.setAppname(appname);
xxlJobSpringExecutor.setAddress(address);
xxlJobSpringExecutor.setIp(ip);
xxlJobSpringExecutor.setPort(port);
xxlJobSpringExecutor.setAccessToken(accessToken);
xxlJobSpringExecutor.setTimeout(timeout);
xxlJobSpringExecutor.setLogPath(logPath);
xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);

@ -17,6 +17,8 @@ xxl.job.admin.accessToken=default_token
### xxl-job timeout by second, default 3s
xxl.job.admin.timeout=3
### xxl-job executor enable, default true
xxl.job.executor.enabled=true
### xxl-job executor appname
xxl.job.executor.appname=xxl-job-executor-sample-ai
### xxl-job executor registry-address: default use address to registry , otherwise use ip:port if address is null

Loading…
Cancel
Save