调度中心与执行器双向通讯超时时间调整为3s

master
xuxueli 6 years ago
parent e45d7525bf
commit 998da25c4a
  1. 5
      doc/XXL-JOB官方文档.md
  2. 2
      xxl-job-admin/src/main/java/com/xxl/job/admin/core/conf/XxlJobScheduler.java
  3. 8
      xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobScheduleHelper.java
  4. 8
      xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java
  5. 4
      xxl-job-admin/src/test/java/com/xxl/job/adminbiz/AdminBizTest.java
  6. 2
      xxl-job-admin/src/test/java/com/xxl/job/executor/ExecutorBizTest.java
  7. 2
      xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java

@ -853,8 +853,8 @@ XXL-JOB的每个调度任务虽然在调度模块是并行调度执行的,但
任务调度错过触发时间时的处理策略:
- 可能原因:服务重启;调度线程被阻塞,线程被耗尽;上次调度持续阻塞,下次调度被错过;
- 处理策略:
- 过期超10s:本地忽略,当前时间开始计算下次触发时间
- 过期超过5s:过期10s内:立即触发一次,当前时间开始计算下次触发时间
- 过期超5s:本地忽略,当前时间开始计算下次触发时间
- 过期超过5s:过期5s内:立即触发一次,当前时间开始计算下次触发时间
#### 5.4.7 日志回调服务
@ -1476,6 +1476,7 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
- 10、项目依赖升级至较新稳定版本,如spring、springboot、groovy、xxl-rpc等等;并清理冗余POM;
- 11、升级xxl-rpc至较新版本,修复代理服务初始化时远程服务不可用导致长连冗余创建的问题;
- 12、首页调度报表的日期排序在TIDB下乱序问题修复;
- 13、调度中心与执行器双向通讯超时时间调整为3s;
### 6.26 版本 v2.1.1 Release Notes[规划中]

@ -134,7 +134,7 @@ public class XxlJobScheduler implements InitializingBean, DisposableBean {
LoadBalance.ROUND,
ExecutorBiz.class,
null,
5000,
3000,
address,
XxlJobAdminConfig.getAdminConfig().getAccessToken(),
null,

@ -63,8 +63,8 @@ public class JobScheduleHelper {
// tx start
// 1、预读10s内调度任务
long maxNextTime = System.currentTimeMillis() + 10000;
// 1、预读5s内调度任务
long maxNextTime = System.currentTimeMillis() + 5000;
long nowTime = System.currentTimeMillis();
List<XxlJobInfo> scheduleList = XxlJobAdminConfig.getAdminConfig().getXxlJobInfoDao().scheduleJobQuery(maxNextTime);
if (scheduleList!=null && scheduleList.size()>0) {
@ -73,7 +73,7 @@ public class JobScheduleHelper {
// 时间轮刻度计算
int ringSecond = -1;
if (jobInfo.getTriggerNextTime() < nowTime - 10000) { // 过期超10s:本地忽略,当前时间开始计算下次触发时间
if (jobInfo.getTriggerNextTime() < nowTime - 5000) { // 过期超5s:本地忽略,当前时间开始计算下次触发时间
ringSecond = -1;
jobInfo.setTriggerLastTime(jobInfo.getTriggerNextTime());
@ -82,7 +82,7 @@ public class JobScheduleHelper {
.getNextValidTimeAfter(new Date())
.getTime()
);
} else if (jobInfo.getTriggerNextTime() < nowTime) { // 过期10s内:立即触发一次,当前时间开始计算下次触发时间
} else if (jobInfo.getTriggerNextTime() < nowTime) { // 过期5s内:立即触发一次,当前时间开始计算下次触发时间
ringSecond = (int)((nowTime/1000)%60);
jobInfo.setTriggerLastTime(jobInfo.getTriggerNextTime());

@ -189,11 +189,11 @@ public class XxlJobServiceImpl implements XxlJobService {
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_id")+I18nUtil.getString("system_not_found")) );
}
// next trigger time (10s后生效,避开预读周期)
// next trigger time (5s后生效,避开预读周期)
long nextTriggerTime = exists_jobInfo.getTriggerNextTime();
if (exists_jobInfo.getTriggerStatus() == 1 && !jobInfo.getJobCron().equals(exists_jobInfo.getJobCron()) ) {
try {
nextTriggerTime = new CronExpression(jobInfo.getJobCron()).getNextValidTimeAfter(new Date(System.currentTimeMillis() + 10000)).getTime();
nextTriggerTime = new CronExpression(jobInfo.getJobCron()).getNextValidTimeAfter(new Date(System.currentTimeMillis() + 5000)).getTime();
} catch (ParseException e) {
logger.error(e.getMessage(), e);
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_unvalid")+" | "+ e.getMessage());
@ -236,10 +236,10 @@ public class XxlJobServiceImpl implements XxlJobService {
public ReturnT<String> start(int id) {
XxlJobInfo xxlJobInfo = xxlJobInfoDao.loadById(id);
// next trigger time (10s后生效,避开预读周期)
// next trigger time (5s后生效,避开预读周期)
long nextTriggerTime = 0;
try {
nextTriggerTime = new CronExpression(xxlJobInfo.getJobCron()).getNextValidTimeAfter(new Date(System.currentTimeMillis() + 10000)).getTime();
nextTriggerTime = new CronExpression(xxlJobInfo.getJobCron()).getNextValidTimeAfter(new Date(System.currentTimeMillis() + 5000)).getTime();
} catch (ParseException e) {
logger.error(e.getMessage(), e);
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_unvalid")+" | "+ e.getMessage());

@ -39,7 +39,7 @@ public class AdminBizTest {
LoadBalance.ROUND,
AdminBiz.class,
null,
10000,
3000,
addressUrl,
accessToken,
null,
@ -69,7 +69,7 @@ public class AdminBizTest {
LoadBalance.ROUND,
AdminBiz.class,
null,
10000,
3000,
addressUrl,
accessToken,
null,

@ -56,7 +56,7 @@ public class ExecutorBizTest {
LoadBalance.ROUND,
ExecutorBiz.class,
null,
10000,
3000,
"127.0.0.1:9999",
null,
null,

@ -127,7 +127,7 @@ public class XxlJobExecutor {
LoadBalance.ROUND,
AdminBiz.class,
null,
10000,
3000,
addressUrl,
accessToken,
null,

Loading…
Cancel
Save