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

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

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

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

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

@ -17,6 +17,8 @@ xxl.job.admin.accessToken=default_token
### xxl-job timeout by second, default 3s ### xxl-job timeout by second, default 3s
xxl.job.admin.timeout=3 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.appname=xxl-job-executor-sample-ai 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 ### xxl-job executor registry-address: default use address to registry , otherwise use ip:port if address is null

Loading…
Cancel
Save