update xxl-job 2.3.0 => 2.3.1

This commit is contained in:
疯狂的狮子Li 2022-05-22 13:07:36 +08:00
parent 8a6ccabffb
commit 7e626ea219
52 changed files with 678 additions and 658 deletions

View File

@ -37,7 +37,7 @@
<lock4j.version>2.2.1</lock4j.version> <lock4j.version>2.2.1</lock4j.version>
<dynamic-ds.version>3.5.1</dynamic-ds.version> <dynamic-ds.version>3.5.1</dynamic-ds.version>
<tlog.version>1.4.0</tlog.version> <tlog.version>1.4.0</tlog.version>
<xxl-job.version>2.3.0</xxl-job.version> <xxl-job.version>2.3.1</xxl-job.version>
<!-- jdk11 缺失依赖 jaxb--> <!-- jdk11 缺失依赖 jaxb-->
<jaxb.version>3.0.1</jaxb.version> <jaxb.version>3.0.1</jaxb.version>

View File

@ -56,13 +56,13 @@ public class IndexController {
@PermissionLimit(limit = false) @PermissionLimit(limit = false)
public ModelAndView toLogin(HttpServletRequest request, HttpServletResponse response, ModelAndView modelAndView) { public ModelAndView toLogin(HttpServletRequest request, HttpServletResponse response, ModelAndView modelAndView) {
if (loginService.ifLogin(request, response) != null) { if (loginService.ifLogin(request, response) != null) {
modelAndView.setView(new RedirectView("/" , true, false)); modelAndView.setView(new RedirectView("/", true, false));
return modelAndView; return modelAndView;
} }
return new ModelAndView("login"); return new ModelAndView("login");
} }
@RequestMapping(value = "login" , method = RequestMethod.POST) @RequestMapping(value = "login", method = RequestMethod.POST)
@ResponseBody @ResponseBody
@PermissionLimit(limit = false) @PermissionLimit(limit = false)
public ReturnT<String> loginDo(HttpServletRequest request, HttpServletResponse response, String userName, String password, String ifRemember) { public ReturnT<String> loginDo(HttpServletRequest request, HttpServletResponse response, String userName, String password, String ifRemember) {
@ -70,7 +70,7 @@ public class IndexController {
return loginService.login(request, response, userName, password, ifRem); return loginService.login(request, response, userName, password, ifRem);
} }
@RequestMapping(value = "logout" , method = RequestMethod.POST) @RequestMapping(value = "logout", method = RequestMethod.POST)
@ResponseBody @ResponseBody
@PermissionLimit(limit = false) @PermissionLimit(limit = false)
public ReturnT<String> logout(HttpServletRequest request, HttpServletResponse response) { public ReturnT<String> logout(HttpServletRequest request, HttpServletResponse response) {

View File

@ -37,18 +37,18 @@ public class JobApiController {
*/ */
@RequestMapping("/{uri}") @RequestMapping("/{uri}")
@ResponseBody @ResponseBody
@PermissionLimit(limit=false) @PermissionLimit(limit = false)
public ReturnT<String> api(HttpServletRequest request, @PathVariable("uri") String uri, @RequestBody(required = false) String data) { public ReturnT<String> api(HttpServletRequest request, @PathVariable("uri") String uri, @RequestBody(required = false) String data) {
// valid // valid
if (!"POST".equalsIgnoreCase(request.getMethod())) { if (!"POST".equalsIgnoreCase(request.getMethod())) {
return new ReturnT<String>(ReturnT.FAIL_CODE, "invalid request, HttpMethod not support."); return new ReturnT<String>(ReturnT.FAIL_CODE, "invalid request, HttpMethod not support.");
} }
if (uri==null || uri.trim().length()==0) { if (uri == null || uri.trim().length() == 0) {
return new ReturnT<String>(ReturnT.FAIL_CODE, "invalid request, uri-mapping empty."); return new ReturnT<String>(ReturnT.FAIL_CODE, "invalid request, uri-mapping empty.");
} }
if (XxlJobAdminConfig.getAdminConfig().getAccessToken()!=null if (XxlJobAdminConfig.getAdminConfig().getAccessToken() != null
&& XxlJobAdminConfig.getAdminConfig().getAccessToken().trim().length()>0 && XxlJobAdminConfig.getAdminConfig().getAccessToken().trim().length() > 0
&& !XxlJobAdminConfig.getAdminConfig().getAccessToken().equals(request.getHeader(XxlJobRemotingUtil.XXL_JOB_ACCESS_TOKEN))) { && !XxlJobAdminConfig.getAdminConfig().getAccessToken().equals(request.getHeader(XxlJobRemotingUtil.XXL_JOB_ACCESS_TOKEN))) {
return new ReturnT<String>(ReturnT.FAIL_CODE, "The access token is wrong."); return new ReturnT<String>(ReturnT.FAIL_CODE, "The access token is wrong.");
} }
@ -64,7 +64,7 @@ public class JobApiController {
RegistryParam registryParam = GsonTool.fromJson(data, RegistryParam.class); RegistryParam registryParam = GsonTool.fromJson(data, RegistryParam.class);
return adminBiz.registryRemove(registryParam); return adminBiz.registryRemove(registryParam);
} else { } else {
return new ReturnT<String>(ReturnT.FAIL_CODE, "invalid request, uri-mapping("+ uri +") not found."); return new ReturnT<String>(ReturnT.FAIL_CODE, "invalid request, uri-mapping(" + uri + ") not found.");
} }
} }

View File

@ -47,10 +47,10 @@ public class JobCodeController {
JobInfoController.validPermission(request, jobInfo.getJobGroup()); JobInfoController.validPermission(request, jobInfo.getJobGroup());
// Glue类型-字典 // Glue类型-字典
model.addAttribute("GlueTypeEnum" , GlueTypeEnum.values()); model.addAttribute("GlueTypeEnum", GlueTypeEnum.values());
model.addAttribute("jobInfo" , jobInfo); model.addAttribute("jobInfo", jobInfo);
model.addAttribute("jobLogGlues" , jobLogGlues); model.addAttribute("jobLogGlues", jobLogGlues);
return "jobcode/jobcode.index"; return "jobcode/jobcode.index";
} }

View File

@ -52,9 +52,9 @@ public class JobGroupController {
// package result // package result
Map<String, Object> maps = new HashMap<String, Object>(); Map<String, Object> maps = new HashMap<String, Object>();
maps.put("recordsTotal" , list_count); // 总记录数 maps.put("recordsTotal", list_count); // 总记录数
maps.put("recordsFiltered" , list_count); // 过滤后的总记录数 maps.put("recordsFiltered", list_count); // 过滤后的总记录数
maps.put("data" , list); // 分页列表 maps.put("data", list); // 分页列表
return maps; return maps;
} }

View File

@ -49,11 +49,11 @@ public class JobInfoController {
public String index(HttpServletRequest request, Model model, @RequestParam(required = false, defaultValue = "-1") int jobGroup) { public String index(HttpServletRequest request, Model model, @RequestParam(required = false, defaultValue = "-1") int jobGroup) {
// 枚举-字典 // 枚举-字典
model.addAttribute("ExecutorRouteStrategyEnum" , ExecutorRouteStrategyEnum.values()); // 路由策略-列表 model.addAttribute("ExecutorRouteStrategyEnum", ExecutorRouteStrategyEnum.values()); // 路由策略-列表
model.addAttribute("GlueTypeEnum" , GlueTypeEnum.values()); // Glue类型-字典 model.addAttribute("GlueTypeEnum", GlueTypeEnum.values()); // Glue类型-字典
model.addAttribute("ExecutorBlockStrategyEnum" , ExecutorBlockStrategyEnum.values()); // 阻塞处理策略-字典 model.addAttribute("ExecutorBlockStrategyEnum", ExecutorBlockStrategyEnum.values()); // 阻塞处理策略-字典
model.addAttribute("ScheduleTypeEnum" , ScheduleTypeEnum.values()); // 调度类型 model.addAttribute("ScheduleTypeEnum", ScheduleTypeEnum.values()); // 调度类型
model.addAttribute("MisfireStrategyEnum" , MisfireStrategyEnum.values()); // 调度过期策略 model.addAttribute("MisfireStrategyEnum", MisfireStrategyEnum.values()); // 调度过期策略
// 执行器列表 // 执行器列表
List<XxlJobGroup> jobGroupList_all = xxlJobGroupDao.findAll(); List<XxlJobGroup> jobGroupList_all = xxlJobGroupDao.findAll();
@ -64,8 +64,8 @@ public class JobInfoController {
throw new XxlJobException(I18nUtil.getString("jobgroup_empty")); throw new XxlJobException(I18nUtil.getString("jobgroup_empty"));
} }
model.addAttribute("JobGroupList" , jobGroupList); model.addAttribute("JobGroupList", jobGroupList);
model.addAttribute("jobGroup" , jobGroup); model.addAttribute("jobGroup", jobGroup);
return "jobinfo/jobinfo.index"; return "jobinfo/jobinfo.index";
} }

View File

@ -1,7 +1,7 @@
package com.xxl.job.admin.controller; package com.xxl.job.admin.controller;
import com.xxl.job.admin.core.complete.XxlJobCompleter;
import com.xxl.job.admin.core.exception.XxlJobException; import com.xxl.job.admin.core.exception.XxlJobException;
import com.xxl.job.admin.core.complete.XxlJobCompleter;
import com.xxl.job.admin.core.model.XxlJobGroup; import com.xxl.job.admin.core.model.XxlJobGroup;
import com.xxl.job.admin.core.model.XxlJobInfo; import com.xxl.job.admin.core.model.XxlJobInfo;
import com.xxl.job.admin.core.model.XxlJobLog; import com.xxl.job.admin.core.model.XxlJobLog;
@ -60,7 +60,7 @@ public class JobLogController {
throw new XxlJobException(I18nUtil.getString("jobgroup_empty")); throw new XxlJobException(I18nUtil.getString("jobgroup_empty"));
} }
model.addAttribute("JobGroupList" , jobGroupList); model.addAttribute("JobGroupList", jobGroupList);
// 任务 // 任务
if (jobId > 0) { if (jobId > 0) {
@ -69,7 +69,7 @@ public class JobLogController {
throw new RuntimeException(I18nUtil.getString("jobinfo_field_id") + I18nUtil.getString("system_unvalid")); throw new RuntimeException(I18nUtil.getString("jobinfo_field_id") + I18nUtil.getString("system_unvalid"));
} }
model.addAttribute("jobInfo" , jobInfo); model.addAttribute("jobInfo", jobInfo);
// valid permission // valid permission
JobInfoController.validPermission(request, jobInfo.getJobGroup()); JobInfoController.validPermission(request, jobInfo.getJobGroup());
@ -112,9 +112,9 @@ public class JobLogController {
// package result // package result
Map<String, Object> maps = new HashMap<String, Object>(); Map<String, Object> maps = new HashMap<String, Object>();
maps.put("recordsTotal" , list_count); // 总记录数 maps.put("recordsTotal", list_count); // 总记录数
maps.put("recordsFiltered" , list_count); // 过滤后的总记录数 maps.put("recordsFiltered", list_count); // 过滤后的总记录数
maps.put("data" , list); // 分页列表 maps.put("data", list); // 分页列表
return maps; return maps;
} }
@ -128,11 +128,11 @@ public class JobLogController {
throw new RuntimeException(I18nUtil.getString("joblog_logid_unvalid")); throw new RuntimeException(I18nUtil.getString("joblog_logid_unvalid"));
} }
model.addAttribute("triggerCode" , jobLog.getTriggerCode()); model.addAttribute("triggerCode", jobLog.getTriggerCode());
model.addAttribute("handleCode" , jobLog.getHandleCode()); model.addAttribute("handleCode", jobLog.getHandleCode());
model.addAttribute("executorAddress" , jobLog.getExecutorAddress()); model.addAttribute("executorAddress", jobLog.getExecutorAddress());
model.addAttribute("triggerTime" , jobLog.getTriggerTime().getTime()); model.addAttribute("triggerTime", jobLog.getTriggerTime().getTime());
model.addAttribute("logId" , jobLog.getId()); model.addAttribute("logId", jobLog.getId());
return "joblog/joblog.detail"; return "joblog/joblog.detail";
} }

View File

@ -40,7 +40,7 @@ public class UserController {
// 执行器列表 // 执行器列表
List<XxlJobGroup> groupList = xxlJobGroupDao.findAll(); List<XxlJobGroup> groupList = xxlJobGroupDao.findAll();
model.addAttribute("groupList" , groupList); model.addAttribute("groupList", groupList);
return "user/user.index"; return "user/user.index";
} }
@ -65,9 +65,9 @@ public class UserController {
// package result // package result
Map<String, Object> maps = new HashMap<String, Object>(); Map<String, Object> maps = new HashMap<String, Object>();
maps.put("recordsTotal" , list_count); // 总记录数 maps.put("recordsTotal", list_count); // 总记录数
maps.put("recordsFiltered" , list_count); // 过滤后的总记录数 maps.put("recordsFiltered", list_count); // 过滤后的总记录数
maps.put("data" , list); // 分页列表 maps.put("data", list); // 分页列表
return maps; return maps;
} }

View File

@ -29,15 +29,14 @@ public class CookieInterceptor implements AsyncHandlerInterceptor {
for (Cookie ck : request.getCookies()) { for (Cookie ck : request.getCookies()) {
cookieMap.put(ck.getName(), ck); cookieMap.put(ck.getName(), ck);
} }
modelAndView.addObject("cookieMap" , cookieMap); modelAndView.addObject("cookieMap", cookieMap);
} }
// static method // static method
if (modelAndView != null) { if (modelAndView != null) {
modelAndView.addObject("I18nUtil" , FtlUtil.generateStaticModel(I18nUtil.class.getName())); modelAndView.addObject("I18nUtil", FtlUtil.generateStaticModel(I18nUtil.class.getName()));
} }
AsyncHandlerInterceptor.super.postHandle(request, response, handler, modelAndView);
} }
} }

View File

@ -27,7 +27,7 @@ public class PermissionInterceptor implements AsyncHandlerInterceptor {
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
if (!(handler instanceof HandlerMethod)) { if (!(handler instanceof HandlerMethod)) {
return AsyncHandlerInterceptor.super.preHandle(request, response, handler); return true; // proceed with the next interceptor
} }
// if need login // if need login
@ -44,7 +44,7 @@ public class PermissionInterceptor implements AsyncHandlerInterceptor {
XxlJobUser loginUser = loginService.ifLogin(request, response); XxlJobUser loginUser = loginService.ifLogin(request, response);
if (loginUser == null) { if (loginUser == null) {
response.setStatus(302); response.setStatus(302);
response.setHeader("location" , request.getContextPath() + "/toLogin"); response.setHeader("location", request.getContextPath() + "/toLogin");
return false; return false;
} }
if (needAdminuser && loginUser.getRole() != 1) { if (needAdminuser && loginUser.getRole() != 1) {
@ -53,7 +53,7 @@ public class PermissionInterceptor implements AsyncHandlerInterceptor {
request.setAttribute(LoginService.LOGIN_IDENTITY_KEY, loginUser); request.setAttribute(LoginService.LOGIN_IDENTITY_KEY, loginUser);
} }
return AsyncHandlerInterceptor.super.preHandle(request, response, handler); return true; // proceed with the next interceptor
} }
} }

View File

@ -1,8 +1,8 @@
package com.xxl.job.admin.controller.resolver; package com.xxl.job.admin.controller.resolver;
import com.xxl.job.admin.core.exception.XxlJobException; import com.xxl.job.admin.core.exception.XxlJobException;
import com.xxl.job.admin.core.util.JacksonUtil;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.admin.core.util.JacksonUtil;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -29,7 +29,7 @@ public class WebExceptionResolver implements HandlerExceptionResolver {
HttpServletResponse response, Object handler, Exception ex) { HttpServletResponse response, Object handler, Exception ex) {
if (!(ex instanceof XxlJobException)) { if (!(ex instanceof XxlJobException)) {
logger.error("WebExceptionResolver:{}" , ex); logger.error("WebExceptionResolver:{}", ex);
} }
// if json // if json
@ -43,7 +43,7 @@ public class WebExceptionResolver implements HandlerExceptionResolver {
} }
// error result // error result
ReturnT<String> errorResult = new ReturnT<String>(ReturnT.FAIL_CODE, ex.toString().replaceAll("\n" , "<br/>")); ReturnT<String> errorResult = new ReturnT<String>(ReturnT.FAIL_CODE, ex.toString().replaceAll("\n", "<br/>"));
// response // response
ModelAndView mv = new ModelAndView(); ModelAndView mv = new ModelAndView();
@ -57,7 +57,7 @@ public class WebExceptionResolver implements HandlerExceptionResolver {
return mv; return mv;
} else { } else {
mv.addObject("exceptionMsg" , errorResult.getMsg()); mv.addObject("exceptionMsg", errorResult.getMsg());
mv.setViewName("/common/common.exception"); mv.setViewName("/common/common.exception");
return mv; return mv;
} }

View File

@ -44,9 +44,9 @@ public class JobAlarmer implements ApplicationContextAware, InitializingBean {
public boolean alarm(XxlJobInfo info, XxlJobLog jobLog) { public boolean alarm(XxlJobInfo info, XxlJobLog jobLog) {
boolean result = false; boolean result = false;
if (jobAlarmList!=null && jobAlarmList.size()>0) { if (jobAlarmList != null && jobAlarmList.size() > 0) {
result = true; // success means all-success result = true; // success means all-success
for (JobAlarm alarm: jobAlarmList) { for (JobAlarm alarm : jobAlarmList) {
boolean resultItem = false; boolean resultItem = false;
try { try {
resultItem = alarm.doAlarm(info, jobLog); resultItem = alarm.doAlarm(info, jobLog);

View File

@ -32,18 +32,19 @@ public class EmailJobAlarm implements JobAlarm {
* *
* @param jobLog * @param jobLog
*/ */
public boolean doAlarm(XxlJobInfo info, XxlJobLog jobLog){ @Override
public boolean doAlarm(XxlJobInfo info, XxlJobLog jobLog) {
boolean alarmResult = true; boolean alarmResult = true;
// send monitor email // send monitor email
if (info!=null && info.getAlarmEmail()!=null && info.getAlarmEmail().trim().length()>0) { if (info != null && info.getAlarmEmail() != null && info.getAlarmEmail().trim().length() > 0) {
// alarmContent // alarmContent
String alarmContent = "Alarm Job LogId=" + jobLog.getId(); String alarmContent = "Alarm Job LogId=" + jobLog.getId();
if (jobLog.getTriggerCode() != ReturnT.SUCCESS_CODE) { if (jobLog.getTriggerCode() != ReturnT.SUCCESS_CODE) {
alarmContent += "<br>TriggerMsg=<br>" + jobLog.getTriggerMsg(); alarmContent += "<br>TriggerMsg=<br>" + jobLog.getTriggerMsg();
} }
if (jobLog.getHandleCode()>0 && jobLog.getHandleCode() != ReturnT.SUCCESS_CODE) { if (jobLog.getHandleCode() > 0 && jobLog.getHandleCode() != ReturnT.SUCCESS_CODE) {
alarmContent += "<br>HandleCode=" + jobLog.getHandleMsg(); alarmContent += "<br>HandleCode=" + jobLog.getHandleMsg();
} }
@ -52,13 +53,13 @@ public class EmailJobAlarm implements JobAlarm {
String personal = I18nUtil.getString("admin_name_full"); String personal = I18nUtil.getString("admin_name_full");
String title = I18nUtil.getString("jobconf_monitor"); String title = I18nUtil.getString("jobconf_monitor");
String content = MessageFormat.format(loadEmailJobAlarmTemplate(), String content = MessageFormat.format(loadEmailJobAlarmTemplate(),
group!=null?group.getTitle():"null", group != null ? group.getTitle() : "null",
info.getId(), info.getId(),
info.getJobDesc(), info.getJobDesc(),
alarmContent); alarmContent);
Set<String> emailSet = new HashSet<String>(Arrays.asList(info.getAlarmEmail().split(","))); Set<String> emailSet = new HashSet<String>(Arrays.asList(info.getAlarmEmail().split(",")));
for (String email: emailSet) { for (String email : emailSet) {
// make mail // make mail
try { try {
@ -88,16 +89,16 @@ public class EmailJobAlarm implements JobAlarm {
* *
* @return * @return
*/ */
private static final String loadEmailJobAlarmTemplate(){ private static final String loadEmailJobAlarmTemplate() {
String mailBodyTemplate = "<h5>" + I18nUtil.getString("jobconf_monitor_detail") + "</span>" + String mailBodyTemplate = "<h5>" + I18nUtil.getString("jobconf_monitor_detail") + "</span>" +
"<table border=\"1\" cellpadding=\"3\" style=\"border-collapse:collapse; width:80%;\" >\n" + "<table border=\"1\" cellpadding=\"3\" style=\"border-collapse:collapse; width:80%;\" >\n" +
" <thead style=\"font-weight: bold;color: #ffffff;background-color: #ff8c00;\" >" + " <thead style=\"font-weight: bold;color: #ffffff;background-color: #ff8c00;\" >" +
" <tr>\n" + " <tr>\n" +
" <td width=\"20%\" >"+ I18nUtil.getString("jobinfo_field_jobgroup") +"</td>\n" + " <td width=\"20%\" >" + I18nUtil.getString("jobinfo_field_jobgroup") + "</td>\n" +
" <td width=\"10%\" >"+ I18nUtil.getString("jobinfo_field_id") +"</td>\n" + " <td width=\"10%\" >" + I18nUtil.getString("jobinfo_field_id") + "</td>\n" +
" <td width=\"20%\" >"+ I18nUtil.getString("jobinfo_field_jobdesc") +"</td>\n" + " <td width=\"20%\" >" + I18nUtil.getString("jobinfo_field_jobdesc") + "</td>\n" +
" <td width=\"10%\" >"+ I18nUtil.getString("jobconf_monitor_alarm_title") +"</td>\n" + " <td width=\"10%\" >" + I18nUtil.getString("jobconf_monitor_alarm_title") + "</td>\n" +
" <td width=\"40%\" >"+ I18nUtil.getString("jobconf_monitor_alarm_content") +"</td>\n" + " <td width=\"40%\" >" + I18nUtil.getString("jobconf_monitor_alarm_content") + "</td>\n" +
" </tr>\n" + " </tr>\n" +
" </thead>\n" + " </thead>\n" +
" <tbody>\n" + " <tbody>\n" +
@ -105,7 +106,7 @@ public class EmailJobAlarm implements JobAlarm {
" <td>{0}</td>\n" + " <td>{0}</td>\n" +
" <td>{1}</td>\n" + " <td>{1}</td>\n" +
" <td>{2}</td>\n" + " <td>{2}</td>\n" +
" <td>"+ I18nUtil.getString("jobconf_monitor_alarm_type") +"</td>\n" + " <td>" + I18nUtil.getString("jobconf_monitor_alarm_type") + "</td>\n" +
" <td>{3}</td>\n" + " <td>{3}</td>\n" +
" </tr>\n" + " </tr>\n" +
" </tbody>\n" + " </tbody>\n" +

View File

@ -32,7 +32,7 @@ public class XxlJobCompleter {
// text最大64kb 避免长度过长 // text最大64kb 避免长度过长
if (xxlJobLog.getHandleMsg().length() > 15000) { if (xxlJobLog.getHandleMsg().length() > 15000) {
xxlJobLog.setHandleMsg( xxlJobLog.getHandleMsg().substring(0, 15000) ); xxlJobLog.setHandleMsg(xxlJobLog.getHandleMsg().substring(0, 15000));
} }
// fresh handle // fresh handle
@ -43,18 +43,18 @@ public class XxlJobCompleter {
/** /**
* do somethind to finish job * do somethind to finish job
*/ */
private static void finishJob(XxlJobLog xxlJobLog){ private static void finishJob(XxlJobLog xxlJobLog) {
// 1handle success, to trigger child job // 1handle success, to trigger child job
String triggerChildMsg = null; String triggerChildMsg = null;
if (XxlJobContext.HANDLE_COCE_SUCCESS == xxlJobLog.getHandleCode()) { if (XxlJobContext.HANDLE_CODE_SUCCESS == xxlJobLog.getHandleCode()) {
XxlJobInfo xxlJobInfo = XxlJobAdminConfig.getAdminConfig().getXxlJobInfoDao().loadById(xxlJobLog.getJobId()); XxlJobInfo xxlJobInfo = XxlJobAdminConfig.getAdminConfig().getXxlJobInfoDao().loadById(xxlJobLog.getJobId());
if (xxlJobInfo!=null && xxlJobInfo.getChildJobId()!=null && xxlJobInfo.getChildJobId().trim().length()>0) { if (xxlJobInfo != null && xxlJobInfo.getChildJobId() != null && xxlJobInfo.getChildJobId().trim().length() > 0) {
triggerChildMsg = "<br><br><span style=\"color:#00c0ef;\" > >>>>>>>>>>>"+ I18nUtil.getString("jobconf_trigger_child_run") +"<<<<<<<<<<< </span><br>"; triggerChildMsg = "<br><br><span style=\"color:#00c0ef;\" > >>>>>>>>>>>" + I18nUtil.getString("jobconf_trigger_child_run") + "<<<<<<<<<<< </span><br>";
String[] childJobIds = xxlJobInfo.getChildJobId().split(","); String[] childJobIds = xxlJobInfo.getChildJobId().split(",");
for (int i = 0; i < childJobIds.length; i++) { for (int i = 0; i < childJobIds.length; i++) {
int childJobId = (childJobIds[i]!=null && childJobIds[i].trim().length()>0 && isNumeric(childJobIds[i]))?Integer.valueOf(childJobIds[i]):-1; int childJobId = (childJobIds[i] != null && childJobIds[i].trim().length() > 0 && isNumeric(childJobIds[i])) ? Integer.valueOf(childJobIds[i]) : -1;
if (childJobId > 0) { if (childJobId > 0) {
JobTriggerPoolHelper.trigger(childJobId, TriggerTypeEnum.PARENT, -1, null, null, null); JobTriggerPoolHelper.trigger(childJobId, TriggerTypeEnum.PARENT, -1, null, null, null);
@ -62,14 +62,14 @@ public class XxlJobCompleter {
// add msg // add msg
triggerChildMsg += MessageFormat.format(I18nUtil.getString("jobconf_callback_child_msg1"), triggerChildMsg += MessageFormat.format(I18nUtil.getString("jobconf_callback_child_msg1"),
(i+1), (i + 1),
childJobIds.length, childJobIds.length,
childJobIds[i], childJobIds[i],
(triggerChildResult.getCode()==ReturnT.SUCCESS_CODE?I18nUtil.getString("system_success"):I18nUtil.getString("system_fail")), (triggerChildResult.getCode() == ReturnT.SUCCESS_CODE ? I18nUtil.getString("system_success") : I18nUtil.getString("system_fail")),
triggerChildResult.getMsg()); triggerChildResult.getMsg());
} else { } else {
triggerChildMsg += MessageFormat.format(I18nUtil.getString("jobconf_callback_child_msg2"), triggerChildMsg += MessageFormat.format(I18nUtil.getString("jobconf_callback_child_msg2"),
(i+1), (i + 1),
childJobIds.length, childJobIds.length,
childJobIds[i]); childJobIds[i]);
} }
@ -79,7 +79,7 @@ public class XxlJobCompleter {
} }
if (triggerChildMsg != null) { if (triggerChildMsg != null) {
xxlJobLog.setHandleMsg( xxlJobLog.getHandleMsg() + triggerChildMsg ); xxlJobLog.setHandleMsg(xxlJobLog.getHandleMsg() + triggerChildMsg);
} }
// 2fix_delay trigger next // 2fix_delay trigger next
@ -87,7 +87,7 @@ public class XxlJobCompleter {
} }
private static boolean isNumeric(String str){ private static boolean isNumeric(String str) {
try { try {
int result = Integer.valueOf(str); int result = Integer.valueOf(str);
return true; return true;

View File

@ -23,6 +23,7 @@ import java.util.Arrays;
public class XxlJobAdminConfig implements InitializingBean, DisposableBean { public class XxlJobAdminConfig implements InitializingBean, DisposableBean {
private static XxlJobAdminConfig adminConfig = null; private static XxlJobAdminConfig adminConfig = null;
public static XxlJobAdminConfig getAdminConfig() { public static XxlJobAdminConfig getAdminConfig() {
return adminConfig; return adminConfig;
} }

View File

@ -191,13 +191,11 @@ import java.util.TreeSet;
* </ul> * </ul>
* </p> * </p>
* *
*
* @author Sharada Jambula, James House * @author Sharada Jambula, James House
* @author Contributions from Mads Henderson * @author Contributions from Mads Henderson
* @author Refactoring from CronTrigger to CronExpression by Aaron Craven * @author Refactoring from CronTrigger to CronExpression by Aaron Craven
* * <p>
* Borrowed from quartz v2.3.1 * Borrowed from quartz v2.3.1
*
*/ */
public final class CronExpression implements Serializable, Cloneable { public final class CronExpression implements Serializable, Cloneable {
@ -217,6 +215,7 @@ public final class CronExpression implements Serializable, Cloneable {
protected static final Map<String, Integer> monthMap = new HashMap<String, Integer>(20); protected static final Map<String, Integer> monthMap = new HashMap<String, Integer>(20);
protected static final Map<String, Integer> dayMap = new HashMap<String, Integer>(60); protected static final Map<String, Integer> dayMap = new HashMap<String, Integer>(60);
static { static {
monthMap.put("JAN", 0); monthMap.put("JAN", 0);
monthMap.put("FEB", 1); monthMap.put("FEB", 1);
@ -265,8 +264,7 @@ public final class CronExpression implements Serializable, Cloneable {
* *
* @param cronExpression String representation of the cron expression the * @param cronExpression String representation of the cron expression the
* new object should represent * new object should represent
* @throws java.text.ParseException * @throws ParseException if the string expression cannot be parsed into a valid
* if the string expression cannot be parsed into a valid
* <CODE>CronExpression</CODE> * <CODE>CronExpression</CODE>
*/ */
public CronExpression(String cronExpression) throws ParseException { public CronExpression(String cronExpression) throws ParseException {
@ -283,8 +281,7 @@ public final class CronExpression implements Serializable, Cloneable {
* Constructs a new {@code CronExpression} as a copy of an existing * Constructs a new {@code CronExpression} as a copy of an existing
* instance. * instance.
* *
* @param expression * @param expression The existing cron expression to be copied
* The existing cron expression to be copied
*/ */
public CronExpression(CronExpression expression) { public CronExpression(CronExpression expression) {
/* /*
@ -363,7 +360,7 @@ public final class CronExpression implements Serializable, Cloneable {
// the second immediately following it. // the second immediately following it.
while (difference == 1000) { while (difference == 1000) {
newDate = getTimeAfter(lastDate); newDate = getTimeAfter(lastDate);
if(newDate == null) if (newDate == null)
break; break;
difference = newDate.getTime() - lastDate.getTime(); difference = newDate.getTime() - lastDate.getTime();
@ -473,14 +470,14 @@ public final class CronExpression implements Serializable, Cloneable {
String expr = exprsTok.nextToken().trim(); String expr = exprsTok.nextToken().trim();
// throw an exception if L is used with other days of the month // throw an exception if L is used with other days of the month
if(exprOn == DAY_OF_MONTH && expr.indexOf('L') != -1 && expr.length() > 1 && expr.contains(",")) { if (exprOn == DAY_OF_MONTH && expr.indexOf('L') != -1 && expr.length() > 1 && expr.contains(",")) {
throw new ParseException("Support for specifying 'L' and 'LW' with other days of the month is not implemented", -1); throw new ParseException("Support for specifying 'L' and 'LW' with other days of the month is not implemented", -1);
} }
// throw an exception if L is used with other days of the week // throw an exception if L is used with other days of the week
if(exprOn == DAY_OF_WEEK && expr.indexOf('L') != -1 && expr.length() > 1 && expr.contains(",")) { if (exprOn == DAY_OF_WEEK && expr.indexOf('L') != -1 && expr.length() > 1 && expr.contains(",")) {
throw new ParseException("Support for specifying 'L' with other days of the week is not implemented", -1); throw new ParseException("Support for specifying 'L' with other days of the week is not implemented", -1);
} }
if(exprOn == DAY_OF_WEEK && expr.indexOf('#') != -1 && expr.indexOf('#', expr.indexOf('#') +1) != -1) { if (exprOn == DAY_OF_WEEK && expr.indexOf('#') != -1 && expr.indexOf('#', expr.indexOf('#') + 1) != -1) {
throw new ParseException("Support for specifying multiple \"nth\" days is not implemented.", -1); throw new ParseException("Support for specifying multiple \"nth\" days is not implemented.", -1);
} }
@ -663,18 +660,18 @@ public final class CronExpression implements Serializable, Cloneable {
if (type == DAY_OF_WEEK) { if (type == DAY_OF_WEEK) {
addToSet(7, 7, 0, type); addToSet(7, 7, 0, type);
} }
if(type == DAY_OF_MONTH && s.length() > i) { if (type == DAY_OF_MONTH && s.length() > i) {
c = s.charAt(i); c = s.charAt(i);
if(c == '-') { if (c == '-') {
ValueSet vs = getValue(0, s, i+1); ValueSet vs = getValue(0, s, i + 1);
lastdayOffset = vs.value; lastdayOffset = vs.value;
if(lastdayOffset > 30) if (lastdayOffset > 30)
throw new ParseException("Offset from last day must be <= 30", i+1); throw new ParseException("Offset from last day must be <= 30", i + 1);
i = vs.pos; i = vs.pos;
} }
if(s.length() > i) { if (s.length() > i) {
c = s.charAt(i); c = s.charAt(i);
if(c == 'W') { if (c == 'W') {
nearestWeekday = true; nearestWeekday = true;
i++; i++;
} }
@ -732,7 +729,7 @@ public final class CronExpression implements Serializable, Cloneable {
if (c == 'L') { if (c == 'L') {
if (type == DAY_OF_WEEK) { if (type == DAY_OF_WEEK) {
if(val < 1 || val > 7) if (val < 1 || val > 7)
throw new ParseException("Day-of-Week values must be between 1 and 7", -1); throw new ParseException("Day-of-Week values must be between 1 and 7", -1);
lastdayOfWeek = true; lastdayOfWeek = true;
} else { } else {
@ -750,7 +747,7 @@ public final class CronExpression implements Serializable, Cloneable {
} else { } else {
throw new ParseException("'W' option is not valid here. (pos=" + i + ")", i); throw new ParseException("'W' option is not valid here. (pos=" + i + ")", i);
} }
if(val > 31) if (val > 31)
throw new ParseException("The 'W' option does not make sense with values larger than 31 (max number of days in a month)", i); throw new ParseException("The 'W' option does not make sense with values larger than 31 (max number of days in a month)", i);
TreeSet<Integer> set = getSet(type); TreeSet<Integer> set = getSet(type);
set.add(val); set.add(val);
@ -1067,14 +1064,28 @@ public final class CronExpression implements Serializable, Cloneable {
int max = -1; int max = -1;
if (stopAt < startAt) { if (stopAt < startAt) {
switch (type) { switch (type) {
case SECOND : max = 60; break; case SECOND:
case MINUTE : max = 60; break; max = 60;
case HOUR : max = 24; break; break;
case MONTH : max = 12; break; case MINUTE:
case DAY_OF_WEEK : max = 7; break; max = 60;
case DAY_OF_MONTH : max = 31; break; break;
case YEAR : throw new IllegalArgumentException("Start year must be less than stop year"); case HOUR:
default : throw new IllegalArgumentException("Unexpected type encountered"); max = 24;
break;
case MONTH:
max = 12;
break;
case DAY_OF_WEEK:
max = 7;
break;
case DAY_OF_MONTH:
max = 31;
break;
case YEAR:
throw new IllegalArgumentException("Start year must be less than stop year");
default:
throw new IllegalArgumentException("Unexpected type encountered");
} }
stopAt += max; stopAt += max;
} }
@ -1088,7 +1099,7 @@ public final class CronExpression implements Serializable, Cloneable {
int i2 = i % max; int i2 = i % max;
// 1-indexed ranges should not include 0, and should include their max // 1-indexed ranges should not include 0, and should include their max
if (i2 == 0 && (type == MONTH || type == DAY_OF_WEEK || type == DAY_OF_MONTH) ) { if (i2 == 0 && (type == MONTH || type == DAY_OF_WEEK || type == DAY_OF_MONTH)) {
i2 = max; i2 = max;
} }
@ -1185,7 +1196,7 @@ public final class CronExpression implements Serializable, Cloneable {
while (!gotOne) { while (!gotOne) {
//if (endTime != null && cl.getTime().after(endTime)) return null; //if (endTime != null && cl.getTime().after(endTime)) return null;
if(cl.get(Calendar.YEAR) > 2999) { // prevent endless loop... if (cl.get(Calendar.YEAR) > 2999) { // prevent endless loop...
return null; return null;
} }
@ -1262,13 +1273,13 @@ public final class CronExpression implements Serializable, Cloneable {
if (dayOfMSpec && !dayOfWSpec) { // get day by day of month rule if (dayOfMSpec && !dayOfWSpec) { // get day by day of month rule
st = daysOfMonth.tailSet(day); st = daysOfMonth.tailSet(day);
if (lastdayOfMonth) { if (lastdayOfMonth) {
if(!nearestWeekday) { if (!nearestWeekday) {
t = day; t = day;
day = getLastDayOfMonth(mon, cl.get(Calendar.YEAR)); day = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
day -= lastdayOffset; day -= lastdayOffset;
if(t > day) { if (t > day) {
mon++; mon++;
if(mon > 12) { if (mon > 12) {
mon = 1; mon = 1;
tmon = 3333; // ensure test of mon != tmon further below fails tmon = 3333; // ensure test of mon != tmon further below fails
cl.add(Calendar.YEAR, 1); cl.add(Calendar.YEAR, 1);
@ -1280,7 +1291,7 @@ public final class CronExpression implements Serializable, Cloneable {
day = getLastDayOfMonth(mon, cl.get(Calendar.YEAR)); day = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
day -= lastdayOffset; day -= lastdayOffset;
java.util.Calendar tcal = java.util.Calendar.getInstance(getTimeZone()); Calendar tcal = Calendar.getInstance(getTimeZone());
tcal.set(Calendar.SECOND, 0); tcal.set(Calendar.SECOND, 0);
tcal.set(Calendar.MINUTE, 0); tcal.set(Calendar.MINUTE, 0);
tcal.set(Calendar.HOUR_OF_DAY, 0); tcal.set(Calendar.HOUR_OF_DAY, 0);
@ -1291,13 +1302,13 @@ public final class CronExpression implements Serializable, Cloneable {
int ldom = getLastDayOfMonth(mon, cl.get(Calendar.YEAR)); int ldom = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
int dow = tcal.get(Calendar.DAY_OF_WEEK); int dow = tcal.get(Calendar.DAY_OF_WEEK);
if(dow == Calendar.SATURDAY && day == 1) { if (dow == Calendar.SATURDAY && day == 1) {
day += 2; day += 2;
} else if(dow == Calendar.SATURDAY) { } else if (dow == Calendar.SATURDAY) {
day -= 1; day -= 1;
} else if(dow == Calendar.SUNDAY && day == ldom) { } else if (dow == Calendar.SUNDAY && day == ldom) {
day -= 2; day -= 2;
} else if(dow == Calendar.SUNDAY) { } else if (dow == Calendar.SUNDAY) {
day += 1; day += 1;
} }
@ -1307,16 +1318,16 @@ public final class CronExpression implements Serializable, Cloneable {
tcal.set(Calendar.DAY_OF_MONTH, day); tcal.set(Calendar.DAY_OF_MONTH, day);
tcal.set(Calendar.MONTH, mon - 1); tcal.set(Calendar.MONTH, mon - 1);
Date nTime = tcal.getTime(); Date nTime = tcal.getTime();
if(nTime.before(afterTime)) { if (nTime.before(afterTime)) {
day = 1; day = 1;
mon++; mon++;
} }
} }
} else if(nearestWeekday) { } else if (nearestWeekday) {
t = day; t = day;
day = daysOfMonth.first(); day = daysOfMonth.first();
java.util.Calendar tcal = java.util.Calendar.getInstance(getTimeZone()); Calendar tcal = Calendar.getInstance(getTimeZone());
tcal.set(Calendar.SECOND, 0); tcal.set(Calendar.SECOND, 0);
tcal.set(Calendar.MINUTE, 0); tcal.set(Calendar.MINUTE, 0);
tcal.set(Calendar.HOUR_OF_DAY, 0); tcal.set(Calendar.HOUR_OF_DAY, 0);
@ -1327,13 +1338,13 @@ public final class CronExpression implements Serializable, Cloneable {
int ldom = getLastDayOfMonth(mon, cl.get(Calendar.YEAR)); int ldom = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
int dow = tcal.get(Calendar.DAY_OF_WEEK); int dow = tcal.get(Calendar.DAY_OF_WEEK);
if(dow == Calendar.SATURDAY && day == 1) { if (dow == Calendar.SATURDAY && day == 1) {
day += 2; day += 2;
} else if(dow == Calendar.SATURDAY) { } else if (dow == Calendar.SATURDAY) {
day -= 1; day -= 1;
} else if(dow == Calendar.SUNDAY && day == ldom) { } else if (dow == Calendar.SUNDAY && day == ldom) {
day -= 2; day -= 2;
} else if(dow == Calendar.SUNDAY) { } else if (dow == Calendar.SUNDAY) {
day += 1; day += 1;
} }
@ -1344,7 +1355,7 @@ public final class CronExpression implements Serializable, Cloneable {
tcal.set(Calendar.DAY_OF_MONTH, day); tcal.set(Calendar.DAY_OF_MONTH, day);
tcal.set(Calendar.MONTH, mon - 1); tcal.set(Calendar.MONTH, mon - 1);
Date nTime = tcal.getTime(); Date nTime = tcal.getTime();
if(nTime.before(afterTime)) { if (nTime.before(afterTime)) {
day = daysOfMonth.first(); day = daysOfMonth.first();
mon++; mon++;
} }
@ -1580,9 +1591,9 @@ public final class CronExpression implements Serializable, Cloneable {
* @param hour the hour to set * @param hour the hour to set
*/ */
protected void setCalendarHour(Calendar cal, int hour) { protected void setCalendarHour(Calendar cal, int hour) {
cal.set(java.util.Calendar.HOUR_OF_DAY, hour); cal.set(Calendar.HOUR_OF_DAY, hour);
if (cal.get(java.util.Calendar.HOUR_OF_DAY) != hour && hour != 24) { if (cal.get(Calendar.HOUR_OF_DAY) != hour && hour != 24) {
cal.set(java.util.Calendar.HOUR_OF_DAY, hour + 1); cal.set(Calendar.HOUR_OF_DAY, hour + 1);
} }
} }

View File

@ -7,6 +7,7 @@ public class XxlJobException extends RuntimeException {
public XxlJobException() { public XxlJobException() {
} }
public XxlJobException(String message) { public XxlJobException(String message) {
super(message); super(message);
} }

View File

@ -19,8 +19,9 @@ public class XxlJobGroup {
// registry list // registry list
private List<String> registryList; // 执行器地址列表(系统注册) private List<String> registryList; // 执行器地址列表(系统注册)
public List<String> getRegistryList() { public List<String> getRegistryList() {
if (addressList!=null && addressList.trim().length()>0) { if (addressList != null && addressList.trim().length() > 0) {
registryList = new ArrayList<String>(Arrays.asList(addressList.split(","))); registryList = new ArrayList<String>(Arrays.asList(addressList.split(",")));
} }
return registryList; return registryList;

View File

@ -1,4 +1,4 @@
//package com.xxl.job.admin.core.jobbean; package com.xxl.job.admin.core.old;//package com.xxl.job.admin.core.jobbean;
// //
//import com.xxl.job.admin.core.thread.JobTriggerPoolHelper; //import com.xxl.job.admin.core.thread.JobTriggerPoolHelper;
//import com.xxl.job.admin.core.trigger.TriggerTypeEnum; //import com.xxl.job.admin.core.trigger.TriggerTypeEnum;

View File

@ -1,4 +1,4 @@
//package com.xxl.job.admin.core.schedule; package com.xxl.job.admin.core.old;//package com.xxl.job.admin.core.schedule;
// //
//import com.xxl.job.admin.core.conf.XxlJobAdminConfig; //import com.xxl.job.admin.core.conf.XxlJobAdminConfig;
//import com.xxl.job.admin.core.jobbean.RemoteHttpJobBean; //import com.xxl.job.admin.core.jobbean.RemoteHttpJobBean;

View File

@ -1,4 +1,4 @@
//package com.xxl.job.admin.core.quartz; package com.xxl.job.admin.core.old;//package com.xxl.job.admin.core.quartz;
// //
//import org.quartz.SchedulerConfigException; //import org.quartz.SchedulerConfigException;
//import org.quartz.spi.ThreadPool; //import org.quartz.spi.ThreadPool;

View File

@ -30,13 +30,14 @@ public enum ExecutorRouteStrategyEnum {
public String getTitle() { public String getTitle() {
return title; return title;
} }
public ExecutorRouter getRouter() { public ExecutorRouter getRouter() {
return router; return router;
} }
public static ExecutorRouteStrategyEnum match(String name, ExecutorRouteStrategyEnum defaultItem){ public static ExecutorRouteStrategyEnum match(String name, ExecutorRouteStrategyEnum defaultItem) {
if (name != null) { if (name != null) {
for (ExecutorRouteStrategyEnum item: ExecutorRouteStrategyEnum.values()) { for (ExecutorRouteStrategyEnum item : ExecutorRouteStrategyEnum.values()) {
if (item.name().equals(name)) { if (item.name().equals(name)) {
return item; return item;
} }

View File

@ -26,9 +26,9 @@ public class ExecutorRouteBusyover extends ExecutorRouter {
idleBeatResult = executorBiz.idleBeat(new IdleBeatParam(triggerParam.getJobId())); idleBeatResult = executorBiz.idleBeat(new IdleBeatParam(triggerParam.getJobId()));
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
idleBeatResult = new ReturnT<String>(ReturnT.FAIL_CODE, ""+e ); idleBeatResult = new ReturnT<String>(ReturnT.FAIL_CODE, "" + e);
} }
idleBeatResultSB.append( (idleBeatResultSB.length()>0)?"<br><br>":"") idleBeatResultSB.append((idleBeatResultSB.length() > 0) ? "<br><br>" : "")
.append(I18nUtil.getString("jobconf_idleBeat") + "") .append(I18nUtil.getString("jobconf_idleBeat") + "")
.append("<br>address").append(address) .append("<br>address").append(address)
.append("<br>code").append(idleBeatResult.getCode()) .append("<br>code").append(idleBeatResult.getCode())

View File

@ -23,6 +23,7 @@ public class ExecutorRouteConsistentHash extends ExecutorRouter {
/** /**
* get hash code on 2^32 ring (md5散列的方式计算hash值) * get hash code on 2^32 ring (md5散列的方式计算hash值)
*
* @param key * @param key
* @return * @return
*/ */
@ -61,7 +62,7 @@ public class ExecutorRouteConsistentHash extends ExecutorRouter {
// ------A1------A2-------A3------ // ------A1------A2-------A3------
// -----------J1------------------ // -----------J1------------------
TreeMap<Long, String> addressRing = new TreeMap<Long, String>(); TreeMap<Long, String> addressRing = new TreeMap<Long, String>();
for (String address: addressList) { for (String address : addressList) {
for (int i = 0; i < VIRTUAL_NODE_NUM; i++) { for (int i = 0; i < VIRTUAL_NODE_NUM; i++) {
long addressHash = hash("SHARD-" + address + "-NODE-" + i); long addressHash = hash("SHARD-" + address + "-NODE-" + i);
addressRing.put(addressHash, address); addressRing.put(addressHash, address);

View File

@ -26,9 +26,9 @@ public class ExecutorRouteFailover extends ExecutorRouter {
beatResult = executorBiz.beat(); beatResult = executorBiz.beat();
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
beatResult = new ReturnT<String>(ReturnT.FAIL_CODE, ""+e ); beatResult = new ReturnT<String>(ReturnT.FAIL_CODE, "" + e);
} }
beatResultSB.append( (beatResultSB.length()>0)?"<br><br>":"") beatResultSB.append((beatResultSB.length() > 0) ? "<br><br>" : "")
.append(I18nUtil.getString("jobconf_beat") + "") .append(I18nUtil.getString("jobconf_beat") + "")
.append("<br>address").append(address) .append("<br>address").append(address)
.append("<br>code").append(beatResult.getCode()) .append("<br>code").append(beatResult.getCode())

View File

@ -12,7 +12,7 @@ import java.util.List;
public class ExecutorRouteFirst extends ExecutorRouter { public class ExecutorRouteFirst extends ExecutorRouter {
@Override @Override
public ReturnT<String> route(TriggerParam triggerParam, List<String> addressList){ public ReturnT<String> route(TriggerParam triggerParam, List<String> addressList) {
return new ReturnT<String>(addressList.get(0)); return new ReturnT<String>(addressList.get(0));
} }

View File

@ -12,7 +12,7 @@ import java.util.concurrent.ConcurrentMap;
* 单个JOB对应的每个执行器使用频率最低的优先被选举 * 单个JOB对应的每个执行器使用频率最低的优先被选举
* a(*)LFU(Least Frequently Used)最不经常使用频率/次数 * a(*)LFU(Least Frequently Used)最不经常使用频率/次数
* bLRU(Least Recently Used)最近最久未使用时间 * bLRU(Least Recently Used)最近最久未使用时间
* * <p>
* Created by xuxueli on 17/3/10. * Created by xuxueli on 17/3/10.
*/ */
public class ExecutorRouteLFU extends ExecutorRouter { public class ExecutorRouteLFU extends ExecutorRouter {
@ -25,7 +25,7 @@ public class ExecutorRouteLFU extends ExecutorRouter {
// cache clear // cache clear
if (System.currentTimeMillis() > CACHE_VALID_TIME) { if (System.currentTimeMillis() > CACHE_VALID_TIME) {
jobLfuMap.clear(); jobLfuMap.clear();
CACHE_VALID_TIME = System.currentTimeMillis() + 1000*60*60*24; CACHE_VALID_TIME = System.currentTimeMillis() + 1000 * 60 * 60 * 24;
} }
// lfu item init // lfu item init
@ -36,20 +36,20 @@ public class ExecutorRouteLFU extends ExecutorRouter {
} }
// put new // put new
for (String address: addressList) { for (String address : addressList) {
if (!lfuItemMap.containsKey(address) || lfuItemMap.get(address) >1000000 ) { if (!lfuItemMap.containsKey(address) || lfuItemMap.get(address) > 1000000) {
lfuItemMap.put(address, new Random().nextInt(addressList.size())); // 初始化时主动Random一次缓解首次压力 lfuItemMap.put(address, new Random().nextInt(addressList.size())); // 初始化时主动Random一次缓解首次压力
} }
} }
// remove old // remove old
List<String> delKeys = new ArrayList<>(); List<String> delKeys = new ArrayList<>();
for (String existKey: lfuItemMap.keySet()) { for (String existKey : lfuItemMap.keySet()) {
if (!addressList.contains(existKey)) { if (!addressList.contains(existKey)) {
delKeys.add(existKey); delKeys.add(existKey);
} }
} }
if (delKeys.size() > 0) { if (delKeys.size() > 0) {
for (String delKey: delKeys) { for (String delKey : delKeys) {
lfuItemMap.remove(delKey); lfuItemMap.remove(delKey);
} }
} }

View File

@ -14,7 +14,7 @@ import java.util.concurrent.ConcurrentMap;
* 单个JOB对应的每个执行器最久为使用的优先被选举 * 单个JOB对应的每个执行器最久为使用的优先被选举
* aLFU(Least Frequently Used)最不经常使用频率/次数 * aLFU(Least Frequently Used)最不经常使用频率/次数
* b(*)LRU(Least Recently Used)最近最久未使用时间 * b(*)LRU(Least Recently Used)最近最久未使用时间
* * <p>
* Created by xuxueli on 17/3/10. * Created by xuxueli on 17/3/10.
*/ */
public class ExecutorRouteLRU extends ExecutorRouter { public class ExecutorRouteLRU extends ExecutorRouter {
@ -27,7 +27,7 @@ public class ExecutorRouteLRU extends ExecutorRouter {
// cache clear // cache clear
if (System.currentTimeMillis() > CACHE_VALID_TIME) { if (System.currentTimeMillis() > CACHE_VALID_TIME) {
jobLRUMap.clear(); jobLRUMap.clear();
CACHE_VALID_TIME = System.currentTimeMillis() + 1000*60*60*24; CACHE_VALID_TIME = System.currentTimeMillis() + 1000 * 60 * 60 * 24;
} }
// init lru // init lru
@ -43,20 +43,20 @@ public class ExecutorRouteLRU extends ExecutorRouter {
} }
// put new // put new
for (String address: addressList) { for (String address : addressList) {
if (!lruItem.containsKey(address)) { if (!lruItem.containsKey(address)) {
lruItem.put(address, address); lruItem.put(address, address);
} }
} }
// remove old // remove old
List<String> delKeys = new ArrayList<>(); List<String> delKeys = new ArrayList<>();
for (String existKey: lruItem.keySet()) { for (String existKey : lruItem.keySet()) {
if (!addressList.contains(existKey)) { if (!addressList.contains(existKey)) {
delKeys.add(existKey); delKeys.add(existKey);
} }
} }
if (delKeys.size() > 0) { if (delKeys.size() > 0) {
for (String delKey: delKeys) { for (String delKey : delKeys) {
lruItem.remove(delKey); lruItem.remove(delKey);
} }
} }

View File

@ -13,7 +13,7 @@ public class ExecutorRouteLast extends ExecutorRouter {
@Override @Override
public ReturnT<String> route(TriggerParam triggerParam, List<String> addressList) { public ReturnT<String> route(TriggerParam triggerParam, List<String> addressList) {
return new ReturnT<String>(addressList.get(addressList.size()-1)); return new ReturnT<String>(addressList.get(addressList.size() - 1));
} }
} }

View File

@ -22,7 +22,7 @@ public class ExecutorRouteRound extends ExecutorRouter {
// cache clear // cache clear
if (System.currentTimeMillis() > CACHE_VALID_TIME) { if (System.currentTimeMillis() > CACHE_VALID_TIME) {
routeCountEachJob.clear(); routeCountEachJob.clear();
CACHE_VALID_TIME = System.currentTimeMillis() + 1000*60*60*24; CACHE_VALID_TIME = System.currentTimeMillis() + 1000 * 60 * 60 * 24;
} }
AtomicInteger count = routeCountEachJob.get(jobId); AtomicInteger count = routeCountEachJob.get(jobId);
@ -39,7 +39,7 @@ public class ExecutorRouteRound extends ExecutorRouter {
@Override @Override
public ReturnT<String> route(TriggerParam triggerParam, List<String> addressList) { public ReturnT<String> route(TriggerParam triggerParam, List<String> addressList) {
String address = addressList.get(count(triggerParam.getJobId())%addressList.size()); String address = addressList.get(count(triggerParam.getJobId()) % addressList.size());
return new ReturnT<String>(address); return new ReturnT<String>(address);
} }

View File

@ -27,8 +27,8 @@ public enum MisfireStrategyEnum {
return title; return title;
} }
public static MisfireStrategyEnum match(String name, MisfireStrategyEnum defaultItem){ public static MisfireStrategyEnum match(String name, MisfireStrategyEnum defaultItem) {
for (MisfireStrategyEnum item: MisfireStrategyEnum.values()) { for (MisfireStrategyEnum item : MisfireStrategyEnum.values()) {
if (item.name().equals(name)) { if (item.name().equals(name)) {
return item; return item;
} }

View File

@ -34,8 +34,8 @@ public enum ScheduleTypeEnum {
return title; return title;
} }
public static ScheduleTypeEnum match(String name, ScheduleTypeEnum defaultItem){ public static ScheduleTypeEnum match(String name, ScheduleTypeEnum defaultItem) {
for (ScheduleTypeEnum item: ScheduleTypeEnum.values()) { for (ScheduleTypeEnum item : ScheduleTypeEnum.values()) {
if (item.name().equals(name)) { if (item.name().equals(name)) {
return item; return item;
} }

View File

@ -70,17 +70,18 @@ public class XxlJobScheduler {
// ---------------------- I18n ---------------------- // ---------------------- I18n ----------------------
private void initI18n(){ private void initI18n() {
for (ExecutorBlockStrategyEnum item:ExecutorBlockStrategyEnum.values()) { for (ExecutorBlockStrategyEnum item : ExecutorBlockStrategyEnum.values()) {
item.setTitle(I18nUtil.getString("jobconf_block_".concat(item.name()))); item.setTitle(I18nUtil.getString("jobconf_block_".concat(item.name())));
} }
} }
// ---------------------- executor-client ---------------------- // ---------------------- executor-client ----------------------
private static ConcurrentMap<String, ExecutorBiz> executorBizRepository = new ConcurrentHashMap<String, ExecutorBiz>(); private static ConcurrentMap<String, ExecutorBiz> executorBizRepository = new ConcurrentHashMap<String, ExecutorBiz>();
public static ExecutorBiz getExecutorBiz(String address) throws Exception { public static ExecutorBiz getExecutorBiz(String address) throws Exception {
// valid // valid
if (address==null || address.trim().length()==0) { if (address == null || address.trim().length() == 0) {
return null; return null;
} }

View File

@ -96,7 +96,7 @@ public class JobCompleteHelper {
} }
} catch (Exception e) { } catch (Exception e) {
if (!toStop) { if (!toStop) {
logger.error(">>>>>>>>>>> xxl-job, job fail monitor thread error:{}" , e); logger.error(">>>>>>>>>>> xxl-job, job fail monitor thread error:{}", e);
} }
} }
@ -144,7 +144,7 @@ public class JobCompleteHelper {
public void run() { public void run() {
for (HandleCallbackParam handleCallbackParam : callbackParamList) { for (HandleCallbackParam handleCallbackParam : callbackParamList) {
ReturnT<String> callbackResult = callback(handleCallbackParam); ReturnT<String> callbackResult = callback(handleCallbackParam);
logger.debug(">>>>>>>>> JobApiController.callback {}, handleCallbackParam={}, callbackResult={}" , logger.debug(">>>>>>>>> JobApiController.callback {}, handleCallbackParam={}, callbackResult={}",
(callbackResult.getCode() == ReturnT.SUCCESS_CODE ? "success" : "fail"), handleCallbackParam, callbackResult); (callbackResult.getCode() == ReturnT.SUCCESS_CODE ? "success" : "fail"), handleCallbackParam, callbackResult);
} }
} }

View File

@ -62,7 +62,7 @@ public class JobFailMonitorHelper {
// 2fail alarm monitor // 2fail alarm monitor
int newAlarmStatus = 0; // 告警状态0-默认-1=锁定状态1-无需告警2-告警成功3-告警失败 int newAlarmStatus = 0; // 告警状态0-默认-1=锁定状态1-无需告警2-告警成功3-告警失败
if (info != null && info.getAlarmEmail() != null && info.getAlarmEmail().trim().length() > 0) { if (info != null) {
boolean alarmResult = XxlJobAdminConfig.getAdminConfig().getJobAlarmer().alarm(info, log); boolean alarmResult = XxlJobAdminConfig.getAdminConfig().getJobAlarmer().alarm(info, log);
newAlarmStatus = alarmResult ? 2 : 3; newAlarmStatus = alarmResult ? 2 : 3;
} else { } else {
@ -75,7 +75,7 @@ public class JobFailMonitorHelper {
} catch (Exception e) { } catch (Exception e) {
if (!toStop) { if (!toStop) {
logger.error(">>>>>>>>>>> xxl-job, job fail monitor thread error:{}" , e); logger.error(">>>>>>>>>>> xxl-job, job fail monitor thread error:{}", e);
} }
} }

View File

@ -20,14 +20,16 @@ public class JobLogReportHelper {
private static Logger logger = LoggerFactory.getLogger(JobLogReportHelper.class); private static Logger logger = LoggerFactory.getLogger(JobLogReportHelper.class);
private static JobLogReportHelper instance = new JobLogReportHelper(); private static JobLogReportHelper instance = new JobLogReportHelper();
public static JobLogReportHelper getInstance(){
public static JobLogReportHelper getInstance() {
return instance; return instance;
} }
private Thread logrThread; private Thread logrThread;
private volatile boolean toStop = false; private volatile boolean toStop = false;
public void start(){
public void start() {
logrThread = new Thread(new Runnable() { logrThread = new Thread(new Runnable() {
@Override @Override
@ -69,10 +71,10 @@ public class JobLogReportHelper {
xxlJobLogReport.setFailCount(0); xxlJobLogReport.setFailCount(0);
Map<String, Object> triggerCountMap = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().findLogReport(todayFrom, todayTo); Map<String, Object> triggerCountMap = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().findLogReport(todayFrom, todayTo);
if (triggerCountMap!=null && triggerCountMap.size()>0) { if (triggerCountMap != null && triggerCountMap.size() > 0) {
int triggerDayCount = triggerCountMap.containsKey("triggerDayCount")?Integer.valueOf(String.valueOf(triggerCountMap.get("triggerDayCount"))):0; int triggerDayCount = triggerCountMap.containsKey("triggerDayCount") ? Integer.valueOf(String.valueOf(triggerCountMap.get("triggerDayCount"))) : 0;
int triggerDayCountRunning = triggerCountMap.containsKey("triggerDayCountRunning")?Integer.valueOf(String.valueOf(triggerCountMap.get("triggerDayCountRunning"))):0; int triggerDayCountRunning = triggerCountMap.containsKey("triggerDayCountRunning") ? Integer.valueOf(String.valueOf(triggerCountMap.get("triggerDayCountRunning"))) : 0;
int triggerDayCountSuc = triggerCountMap.containsKey("triggerDayCountSuc")?Integer.valueOf(String.valueOf(triggerCountMap.get("triggerDayCountSuc"))):0; int triggerDayCountSuc = triggerCountMap.containsKey("triggerDayCountSuc") ? Integer.valueOf(String.valueOf(triggerCountMap.get("triggerDayCountSuc"))) : 0;
int triggerDayCountFail = triggerDayCount - triggerDayCountRunning - triggerDayCountSuc; int triggerDayCountFail = triggerDayCount - triggerDayCountRunning - triggerDayCountSuc;
xxlJobLogReport.setRunningCount(triggerDayCountRunning); xxlJobLogReport.setRunningCount(triggerDayCountRunning);
@ -94,8 +96,8 @@ public class JobLogReportHelper {
} }
// 2log-clean: switch open & once each day // 2log-clean: switch open & once each day
if (XxlJobAdminConfig.getAdminConfig().getLogretentiondays()>0 if (XxlJobAdminConfig.getAdminConfig().getLogretentiondays() > 0
&& System.currentTimeMillis() - lastCleanLogTime > 24*60*60*1000) { && System.currentTimeMillis() - lastCleanLogTime > 24 * 60 * 60 * 1000) {
// expire-time // expire-time
Calendar expiredDay = Calendar.getInstance(); Calendar expiredDay = Calendar.getInstance();
@ -110,10 +112,10 @@ public class JobLogReportHelper {
List<Long> logIds = null; List<Long> logIds = null;
do { do {
logIds = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().findClearLogIds(0, 0, clearBeforeTime, 0, 1000); logIds = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().findClearLogIds(0, 0, clearBeforeTime, 0, 1000);
if (logIds!=null && logIds.size()>0) { if (logIds != null && logIds.size() > 0) {
XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().clearLog(logIds); XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().clearLog(logIds);
} }
} while (logIds!=null && logIds.size()>0); } while (logIds != null && logIds.size() > 0);
// update clean time // update clean time
lastCleanLogTime = System.currentTimeMillis(); lastCleanLogTime = System.currentTimeMillis();
@ -138,7 +140,7 @@ public class JobLogReportHelper {
logrThread.start(); logrThread.start();
} }
public void toStop(){ public void toStop() {
toStop = true; toStop = true;
// interrupt and wait // interrupt and wait
logrThread.interrupt(); logrThread.interrupt();

View File

@ -111,14 +111,14 @@ public class JobRegistryHelper {
} }
} catch (Exception e) { } catch (Exception e) {
if (!toStop) { if (!toStop) {
logger.error(">>>>>>>>>>> xxl-job, job registry monitor thread error:{}" , e); logger.error(">>>>>>>>>>> xxl-job, job registry monitor thread error:{}", e);
} }
} }
try { try {
TimeUnit.SECONDS.sleep(RegistryConfig.BEAT_TIMEOUT); TimeUnit.SECONDS.sleep(RegistryConfig.BEAT_TIMEOUT);
} catch (InterruptedException e) { } catch (InterruptedException e) {
if (!toStop) { if (!toStop) {
logger.error(">>>>>>>>>>> xxl-job, job registry monitor thread error:{}" , e); logger.error(">>>>>>>>>>> xxl-job, job registry monitor thread error:{}", e);
} }
} }
} }

View File

@ -23,7 +23,8 @@ public class JobScheduleHelper {
private static Logger logger = LoggerFactory.getLogger(JobScheduleHelper.class); private static Logger logger = LoggerFactory.getLogger(JobScheduleHelper.class);
private static JobScheduleHelper instance = new JobScheduleHelper(); private static JobScheduleHelper instance = new JobScheduleHelper();
public static JobScheduleHelper getInstance(){
public static JobScheduleHelper getInstance() {
return instance; return instance;
} }
@ -35,7 +36,7 @@ public class JobScheduleHelper {
private volatile boolean ringThreadToStop = false; private volatile boolean ringThreadToStop = false;
private volatile static Map<Integer, List<Integer>> ringData = new ConcurrentHashMap<>(); private volatile static Map<Integer, List<Integer>> ringData = new ConcurrentHashMap<>();
public void start(){ public void start() {
// schedule thread // schedule thread
scheduleThread = new Thread(new Runnable() { scheduleThread = new Thread(new Runnable() {
@ -43,7 +44,7 @@ public class JobScheduleHelper {
public void run() { public void run() {
try { try {
TimeUnit.MILLISECONDS.sleep(5000 - System.currentTimeMillis()%1000 ); TimeUnit.MILLISECONDS.sleep(5000 - System.currentTimeMillis() % 1000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
if (!scheduleThreadToStop) { if (!scheduleThreadToStop) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
@ -70,7 +71,7 @@ public class JobScheduleHelper {
connAutoCommit = conn.getAutoCommit(); connAutoCommit = conn.getAutoCommit();
conn.setAutoCommit(false); conn.setAutoCommit(false);
preparedStatement = conn.prepareStatement( "select * from xxl_job_lock where lock_name = 'schedule_lock' for update" ); preparedStatement = conn.prepareStatement("select * from xxl_job_lock where lock_name = 'schedule_lock' for update");
preparedStatement.execute(); preparedStatement.execute();
// tx start // tx start
@ -78,9 +79,9 @@ public class JobScheduleHelper {
// 1pre read // 1pre read
long nowTime = System.currentTimeMillis(); long nowTime = System.currentTimeMillis();
List<XxlJobInfo> scheduleList = XxlJobAdminConfig.getAdminConfig().getXxlJobInfoDao().scheduleJobQuery(nowTime + PRE_READ_MS, preReadCount); List<XxlJobInfo> scheduleList = XxlJobAdminConfig.getAdminConfig().getXxlJobInfoDao().scheduleJobQuery(nowTime + PRE_READ_MS, preReadCount);
if (scheduleList!=null && scheduleList.size()>0) { if (scheduleList != null && scheduleList.size() > 0) {
// 2push time-ring // 2push time-ring
for (XxlJobInfo jobInfo: scheduleList) { for (XxlJobInfo jobInfo : scheduleList) {
// time-ring jump // time-ring jump
if (nowTime > jobInfo.getTriggerNextTime() + PRE_READ_MS) { if (nowTime > jobInfo.getTriggerNextTime() + PRE_READ_MS) {
@ -92,7 +93,7 @@ public class JobScheduleHelper {
if (MisfireStrategyEnum.FIRE_ONCE_NOW == misfireStrategyEnum) { if (MisfireStrategyEnum.FIRE_ONCE_NOW == misfireStrategyEnum) {
// FIRE_ONCE_NOW trigger // FIRE_ONCE_NOW trigger
JobTriggerPoolHelper.trigger(jobInfo.getId(), TriggerTypeEnum.MISFIRE, -1, null, null, null); JobTriggerPoolHelper.trigger(jobInfo.getId(), TriggerTypeEnum.MISFIRE, -1, null, null, null);
logger.debug(">>>>>>>>>>> xxl-job, schedule push trigger : jobId = " + jobInfo.getId() ); logger.debug(">>>>>>>>>>> xxl-job, schedule push trigger : jobId = " + jobInfo.getId());
} }
// 2fresh next // 2fresh next
@ -103,16 +104,16 @@ public class JobScheduleHelper {
// 1trigger // 1trigger
JobTriggerPoolHelper.trigger(jobInfo.getId(), TriggerTypeEnum.CRON, -1, null, null, null); JobTriggerPoolHelper.trigger(jobInfo.getId(), TriggerTypeEnum.CRON, -1, null, null, null);
logger.debug(">>>>>>>>>>> xxl-job, schedule push trigger : jobId = " + jobInfo.getId() ); logger.debug(">>>>>>>>>>> xxl-job, schedule push trigger : jobId = " + jobInfo.getId());
// 2fresh next // 2fresh next
refreshNextValidTime(jobInfo, new Date()); refreshNextValidTime(jobInfo, new Date());
// next-trigger-time in 5s, pre-read again // next-trigger-time in 5s, pre-read again
if (jobInfo.getTriggerStatus()==1 && nowTime + PRE_READ_MS > jobInfo.getTriggerNextTime()) { if (jobInfo.getTriggerStatus() == 1 && nowTime + PRE_READ_MS > jobInfo.getTriggerNextTime()) {
// 1make ring second // 1make ring second
int ringSecond = (int)((jobInfo.getTriggerNextTime()/1000)%60); int ringSecond = (int) ((jobInfo.getTriggerNextTime() / 1000) % 60);
// 2push time ring // 2push time ring
pushTimeRing(ringSecond, jobInfo.getId()); pushTimeRing(ringSecond, jobInfo.getId());
@ -126,7 +127,7 @@ public class JobScheduleHelper {
// 2.3trigger-pre-readtime-ring trigger && make next-trigger-time // 2.3trigger-pre-readtime-ring trigger && make next-trigger-time
// 1make ring second // 1make ring second
int ringSecond = (int)((jobInfo.getTriggerNextTime()/1000)%60); int ringSecond = (int) ((jobInfo.getTriggerNextTime() / 1000) % 60);
// 2push time ring // 2push time ring
pushTimeRing(ringSecond, jobInfo.getId()); pushTimeRing(ringSecond, jobInfo.getId());
@ -139,7 +140,7 @@ public class JobScheduleHelper {
} }
// 3update trigger info // 3update trigger info
for (XxlJobInfo jobInfo: scheduleList) { for (XxlJobInfo jobInfo : scheduleList) {
XxlJobAdminConfig.getAdminConfig().getXxlJobInfoDao().scheduleUpdate(jobInfo); XxlJobAdminConfig.getAdminConfig().getXxlJobInfoDao().scheduleUpdate(jobInfo);
} }
@ -192,14 +193,14 @@ public class JobScheduleHelper {
} }
} }
} }
long cost = System.currentTimeMillis()-start; long cost = System.currentTimeMillis() - start;
// Wait seconds, align second // Wait seconds, align second
if (cost < 1000) { // scan-overtime, not wait if (cost < 1000) { // scan-overtime, not wait
try { try {
// pre-read period: success > scan each second; fail > skip this period; // pre-read period: success > scan each second; fail > skip this period;
TimeUnit.MILLISECONDS.sleep((preReadSuc?1000:PRE_READ_MS) - System.currentTimeMillis()%1000); TimeUnit.MILLISECONDS.sleep((preReadSuc ? 1000 : PRE_READ_MS) - System.currentTimeMillis() % 1000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
if (!scheduleThreadToStop) { if (!scheduleThreadToStop) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
@ -238,17 +239,17 @@ public class JobScheduleHelper {
List<Integer> ringItemData = new ArrayList<>(); List<Integer> ringItemData = new ArrayList<>();
int nowSecond = Calendar.getInstance().get(Calendar.SECOND); // 避免处理耗时太长跨过刻度向前校验一个刻度 int nowSecond = Calendar.getInstance().get(Calendar.SECOND); // 避免处理耗时太长跨过刻度向前校验一个刻度
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
List<Integer> tmpData = ringData.remove( (nowSecond+60-i)%60 ); List<Integer> tmpData = ringData.remove((nowSecond + 60 - i) % 60);
if (tmpData != null) { if (tmpData != null) {
ringItemData.addAll(tmpData); ringItemData.addAll(tmpData);
} }
} }
// ring trigger // ring trigger
logger.debug(">>>>>>>>>>> xxl-job, time-ring beat : " + nowSecond + " = " + Arrays.asList(ringItemData) ); logger.debug(">>>>>>>>>>> xxl-job, time-ring beat : " + nowSecond + " = " + Arrays.asList(ringItemData));
if (ringItemData.size() > 0) { if (ringItemData.size() > 0) {
// do trigger // do trigger
for (int jobId: ringItemData) { for (int jobId : ringItemData) {
// do trigger // do trigger
JobTriggerPoolHelper.trigger(jobId, TriggerTypeEnum.CRON, -1, null, null, null); JobTriggerPoolHelper.trigger(jobId, TriggerTypeEnum.CRON, -1, null, null, null);
} }
@ -283,7 +284,7 @@ public class JobScheduleHelper {
} }
} }
private void pushTimeRing(int ringSecond, int jobId){ private void pushTimeRing(int ringSecond, int jobId) {
// push async ring // push async ring
List<Integer> ringItemData = ringData.get(ringSecond); List<Integer> ringItemData = ringData.get(ringSecond);
if (ringItemData == null) { if (ringItemData == null) {
@ -292,10 +293,10 @@ public class JobScheduleHelper {
} }
ringItemData.add(jobId); ringItemData.add(jobId);
logger.debug(">>>>>>>>>>> xxl-job, schedule push time-ring : " + ringSecond + " = " + Arrays.asList(ringItemData) ); logger.debug(">>>>>>>>>>> xxl-job, schedule push time-ring : " + ringSecond + " = " + Arrays.asList(ringItemData));
} }
public void toStop(){ public void toStop() {
// 1stop schedule // 1stop schedule
scheduleThreadToStop = true; scheduleThreadToStop = true;
@ -304,7 +305,7 @@ public class JobScheduleHelper {
} catch (InterruptedException e) { } catch (InterruptedException e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
} }
if (scheduleThread.getState() != Thread.State.TERMINATED){ if (scheduleThread.getState() != Thread.State.TERMINATED) {
// interrupt and wait // interrupt and wait
scheduleThread.interrupt(); scheduleThread.interrupt();
try { try {
@ -319,7 +320,7 @@ public class JobScheduleHelper {
if (!ringData.isEmpty()) { if (!ringData.isEmpty()) {
for (int second : ringData.keySet()) { for (int second : ringData.keySet()) {
List<Integer> tmpData = ringData.get(second); List<Integer> tmpData = ringData.get(second);
if (tmpData!=null && tmpData.size()>0) { if (tmpData != null && tmpData.size() > 0) {
hasRingData = true; hasRingData = true;
break; break;
} }
@ -340,7 +341,7 @@ public class JobScheduleHelper {
} catch (InterruptedException e) { } catch (InterruptedException e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
} }
if (ringThread.getState() != Thread.State.TERMINATED){ if (ringThread.getState() != Thread.State.TERMINATED) {
// interrupt and wait // interrupt and wait
ringThread.interrupt(); ringThread.interrupt();
try { try {
@ -361,7 +362,7 @@ public class JobScheduleHelper {
Date nextValidTime = new CronExpression(jobInfo.getScheduleConf()).getNextValidTimeAfter(fromTime); Date nextValidTime = new CronExpression(jobInfo.getScheduleConf()).getNextValidTimeAfter(fromTime);
return nextValidTime; return nextValidTime;
} else if (ScheduleTypeEnum.FIX_RATE == scheduleTypeEnum /*|| ScheduleTypeEnum.FIX_DELAY == scheduleTypeEnum*/) { } else if (ScheduleTypeEnum.FIX_RATE == scheduleTypeEnum /*|| ScheduleTypeEnum.FIX_DELAY == scheduleTypeEnum*/) {
return new Date(fromTime.getTime() + Integer.valueOf(jobInfo.getScheduleConf())*1000 ); return new Date(fromTime.getTime() + Integer.valueOf(jobInfo.getScheduleConf()) * 1000);
} }
return null; return null;
} }

View File

@ -16,10 +16,12 @@ public enum TriggerTypeEnum {
API(I18nUtil.getString("jobconf_trigger_type_api")), API(I18nUtil.getString("jobconf_trigger_type_api")),
MISFIRE(I18nUtil.getString("jobconf_trigger_type_misfire")); MISFIRE(I18nUtil.getString("jobconf_trigger_type_misfire"));
private TriggerTypeEnum(String title){ private TriggerTypeEnum(String title) {
this.title = title; this.title = title;
} }
private String title; private String title;
public String getTitle() { public String getTitle() {
return title; return title;
} }

View File

@ -30,15 +30,12 @@ public class XxlJobTrigger {
* *
* @param jobId * @param jobId
* @param triggerType * @param triggerType
* @param failRetryCount * @param failRetryCount >=0: use this param
* >=0: use this param
* <0: use param from job info config * <0: use param from job info config
* @param executorShardingParam * @param executorShardingParam
* @param executorParam * @param executorParam null: use job param
* null: use job param
* not null: cover job param * not null: cover job param
* @param addressList * @param addressList null: use executor addressList
* null: use executor addressList
* not null: cover * not null: cover
*/ */
public static void trigger(int jobId, public static void trigger(int jobId,
@ -57,28 +54,28 @@ public class XxlJobTrigger {
if (executorParam != null) { if (executorParam != null) {
jobInfo.setExecutorParam(executorParam); jobInfo.setExecutorParam(executorParam);
} }
int finalFailRetryCount = failRetryCount>=0?failRetryCount:jobInfo.getExecutorFailRetryCount(); int finalFailRetryCount = failRetryCount >= 0 ? failRetryCount : jobInfo.getExecutorFailRetryCount();
XxlJobGroup group = XxlJobAdminConfig.getAdminConfig().getXxlJobGroupDao().load(jobInfo.getJobGroup()); XxlJobGroup group = XxlJobAdminConfig.getAdminConfig().getXxlJobGroupDao().load(jobInfo.getJobGroup());
// cover addressList // cover addressList
if (addressList!=null && addressList.trim().length()>0) { if (addressList != null && addressList.trim().length() > 0) {
group.setAddressType(1); group.setAddressType(1);
group.setAddressList(addressList.trim()); group.setAddressList(addressList.trim());
} }
// sharding param // sharding param
int[] shardingParam = null; int[] shardingParam = null;
if (executorShardingParam!=null){ if (executorShardingParam != null) {
String[] shardingArr = executorShardingParam.split("/"); String[] shardingArr = executorShardingParam.split("/");
if (shardingArr.length==2 && isNumeric(shardingArr[0]) && isNumeric(shardingArr[1])) { if (shardingArr.length == 2 && isNumeric(shardingArr[0]) && isNumeric(shardingArr[1])) {
shardingParam = new int[2]; shardingParam = new int[2];
shardingParam[0] = Integer.valueOf(shardingArr[0]); shardingParam[0] = Integer.valueOf(shardingArr[0]);
shardingParam[1] = Integer.valueOf(shardingArr[1]); shardingParam[1] = Integer.valueOf(shardingArr[1]);
} }
} }
if (ExecutorRouteStrategyEnum.SHARDING_BROADCAST==ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null) if (ExecutorRouteStrategyEnum.SHARDING_BROADCAST == ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null)
&& group.getRegistryList()!=null && !group.getRegistryList().isEmpty() && group.getRegistryList() != null && !group.getRegistryList().isEmpty()
&& shardingParam==null) { && shardingParam == null) {
for (int i = 0; i < group.getRegistryList().size(); i++) { for (int i = 0; i < group.getRegistryList().size(); i++) {
processTrigger(group, jobInfo, finalFailRetryCount, triggerType, i, group.getRegistryList().size()); processTrigger(group, jobInfo, finalFailRetryCount, triggerType, i, group.getRegistryList().size());
} }
@ -91,7 +88,7 @@ public class XxlJobTrigger {
} }
private static boolean isNumeric(String str){ private static boolean isNumeric(String str) {
try { try {
int result = Integer.valueOf(str); int result = Integer.valueOf(str);
return true; return true;
@ -108,12 +105,12 @@ public class XxlJobTrigger {
* @param index sharding index * @param index sharding index
* @param total sharding index * @param total sharding index
*/ */
private static void processTrigger(XxlJobGroup group, XxlJobInfo jobInfo, int finalFailRetryCount, TriggerTypeEnum triggerType, int index, int total){ private static void processTrigger(XxlJobGroup group, XxlJobInfo jobInfo, int finalFailRetryCount, TriggerTypeEnum triggerType, int index, int total) {
// param // param
ExecutorBlockStrategyEnum blockStrategy = ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), ExecutorBlockStrategyEnum.SERIAL_EXECUTION); // block strategy ExecutorBlockStrategyEnum blockStrategy = ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), ExecutorBlockStrategyEnum.SERIAL_EXECUTION); // block strategy
ExecutorRouteStrategyEnum executorRouteStrategyEnum = ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null); // route strategy ExecutorRouteStrategyEnum executorRouteStrategyEnum = ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null); // route strategy
String shardingParam = (ExecutorRouteStrategyEnum.SHARDING_BROADCAST==executorRouteStrategyEnum)?String.valueOf(index).concat("/").concat(String.valueOf(total)):null; String shardingParam = (ExecutorRouteStrategyEnum.SHARDING_BROADCAST == executorRouteStrategyEnum) ? String.valueOf(index).concat("/").concat(String.valueOf(total)) : null;
// 1save log-id // 1save log-id
XxlJobLog jobLog = new XxlJobLog(); XxlJobLog jobLog = new XxlJobLog();
@ -141,7 +138,7 @@ public class XxlJobTrigger {
// 3init address // 3init address
String address = null; String address = null;
ReturnT<String> routeAddressResult = null; ReturnT<String> routeAddressResult = null;
if (group.getRegistryList()!=null && !group.getRegistryList().isEmpty()) { if (group.getRegistryList() != null && !group.getRegistryList().isEmpty()) {
if (ExecutorRouteStrategyEnum.SHARDING_BROADCAST == executorRouteStrategyEnum) { if (ExecutorRouteStrategyEnum.SHARDING_BROADCAST == executorRouteStrategyEnum) {
if (index < group.getRegistryList().size()) { if (index < group.getRegistryList().size()) {
address = group.getRegistryList().get(index); address = group.getRegistryList().get(index);
@ -171,18 +168,18 @@ public class XxlJobTrigger {
triggerMsgSb.append(I18nUtil.getString("jobconf_trigger_type")).append("").append(triggerType.getTitle()); triggerMsgSb.append(I18nUtil.getString("jobconf_trigger_type")).append("").append(triggerType.getTitle());
triggerMsgSb.append("<br>").append(I18nUtil.getString("jobconf_trigger_admin_adress")).append("").append(IpUtil.getIp()); triggerMsgSb.append("<br>").append(I18nUtil.getString("jobconf_trigger_admin_adress")).append("").append(IpUtil.getIp());
triggerMsgSb.append("<br>").append(I18nUtil.getString("jobconf_trigger_exe_regtype")).append("") triggerMsgSb.append("<br>").append(I18nUtil.getString("jobconf_trigger_exe_regtype")).append("")
.append( (group.getAddressType() == 0)?I18nUtil.getString("jobgroup_field_addressType_0"):I18nUtil.getString("jobgroup_field_addressType_1") ); .append((group.getAddressType() == 0) ? I18nUtil.getString("jobgroup_field_addressType_0") : I18nUtil.getString("jobgroup_field_addressType_1"));
triggerMsgSb.append("<br>").append(I18nUtil.getString("jobconf_trigger_exe_regaddress")).append("").append(group.getRegistryList()); triggerMsgSb.append("<br>").append(I18nUtil.getString("jobconf_trigger_exe_regaddress")).append("").append(group.getRegistryList());
triggerMsgSb.append("<br>").append(I18nUtil.getString("jobinfo_field_executorRouteStrategy")).append("").append(executorRouteStrategyEnum.getTitle()); triggerMsgSb.append("<br>").append(I18nUtil.getString("jobinfo_field_executorRouteStrategy")).append("").append(executorRouteStrategyEnum.getTitle());
if (shardingParam != null) { if (shardingParam != null) {
triggerMsgSb.append("("+shardingParam+")"); triggerMsgSb.append("(" + shardingParam + ")");
} }
triggerMsgSb.append("<br>").append(I18nUtil.getString("jobinfo_field_executorBlockStrategy")).append("").append(blockStrategy.getTitle()); triggerMsgSb.append("<br>").append(I18nUtil.getString("jobinfo_field_executorBlockStrategy")).append("").append(blockStrategy.getTitle());
triggerMsgSb.append("<br>").append(I18nUtil.getString("jobinfo_field_timeout")).append("").append(jobInfo.getExecutorTimeout()); triggerMsgSb.append("<br>").append(I18nUtil.getString("jobinfo_field_timeout")).append("").append(jobInfo.getExecutorTimeout());
triggerMsgSb.append("<br>").append(I18nUtil.getString("jobinfo_field_executorFailRetryCount")).append("").append(finalFailRetryCount); triggerMsgSb.append("<br>").append(I18nUtil.getString("jobinfo_field_executorFailRetryCount")).append("").append(finalFailRetryCount);
triggerMsgSb.append("<br><br><span style=\"color:#00c0ef;\" > >>>>>>>>>>>"+ I18nUtil.getString("jobconf_trigger_run") +"<<<<<<<<<<< </span><br>") triggerMsgSb.append("<br><br><span style=\"color:#00c0ef;\" > >>>>>>>>>>>" + I18nUtil.getString("jobconf_trigger_run") + "<<<<<<<<<<< </span><br>")
.append((routeAddressResult!=null&&routeAddressResult.getMsg()!=null)?routeAddressResult.getMsg()+"<br><br>":"").append(triggerResult.getMsg()!=null?triggerResult.getMsg():""); .append((routeAddressResult != null && routeAddressResult.getMsg() != null) ? routeAddressResult.getMsg() + "<br><br>" : "").append(triggerResult.getMsg() != null ? triggerResult.getMsg() : "");
// 6save log trigger-info // 6save log trigger-info
jobLog.setExecutorAddress(address); jobLog.setExecutorAddress(address);
@ -200,11 +197,12 @@ public class XxlJobTrigger {
/** /**
* run executor * run executor
*
* @param triggerParam * @param triggerParam
* @param address * @param address
* @return * @return
*/ */
public static ReturnT<String> runExecutor(TriggerParam triggerParam, String address){ public static ReturnT<String> runExecutor(TriggerParam triggerParam, String address) {
ReturnT<String> runResult = null; ReturnT<String> runResult = null;
try { try {
ExecutorBiz executorBiz = XxlJobScheduler.getExecutorBiz(address); ExecutorBiz executorBiz = XxlJobScheduler.getExecutorBiz(address);

View File

@ -91,7 +91,7 @@ public class CookieUtil {
public static void remove(HttpServletRequest request, HttpServletResponse response, String key) { public static void remove(HttpServletRequest request, HttpServletResponse response, String key) {
Cookie cookie = get(request, key); Cookie cookie = get(request, key);
if (cookie != null) { if (cookie != null) {
set(response, key, "" , null, COOKIE_PATH, 0, true); set(response, key, "", null, COOKIE_PATH, 0, true);
} }
} }

View File

@ -23,7 +23,8 @@ public class I18nUtil {
private static Logger logger = LoggerFactory.getLogger(I18nUtil.class); private static Logger logger = LoggerFactory.getLogger(I18nUtil.class);
private static Properties prop = null; private static Properties prop = null;
public static Properties loadI18nProp(){
public static Properties loadI18nProp() {
if (prop != null) { if (prop != null) {
return prop; return prop;
} }
@ -34,7 +35,7 @@ public class I18nUtil {
// load prop // load prop
Resource resource = new ClassPathResource(i18nFile); Resource resource = new ClassPathResource(i18nFile);
EncodedResource encodedResource = new EncodedResource(resource,"UTF-8"); EncodedResource encodedResource = new EncodedResource(resource, "UTF-8");
prop = PropertiesLoaderUtils.loadProperties(encodedResource); prop = PropertiesLoaderUtils.loadProperties(encodedResource);
} catch (IOException e) { } catch (IOException e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
@ -62,12 +63,12 @@ public class I18nUtil {
Map<String, String> map = new HashMap<String, String>(); Map<String, String> map = new HashMap<String, String>();
Properties prop = loadI18nProp(); Properties prop = loadI18nProp();
if (keys!=null && keys.length>0) { if (keys != null && keys.length > 0) {
for (String key: keys) { for (String key : keys) {
map.put(key, prop.getProperty(key)); map.put(key, prop.getProperty(key));
} }
} else { } else {
for (String key: prop.stringPropertyNames()) { for (String key : prop.stringPropertyNames()) {
map.put(key, prop.getProperty(key)); map.put(key, prop.getProperty(key));
} }
} }

View File

@ -11,7 +11,8 @@ import java.util.concurrent.ConcurrentMap;
public class LocalCacheUtil { public class LocalCacheUtil {
private static ConcurrentMap<String, LocalCacheData> cacheRepository = new ConcurrentHashMap<String, LocalCacheData>(); // 类型建议用抽象父类兼容性更好 private static ConcurrentMap<String, LocalCacheData> cacheRepository = new ConcurrentHashMap<String, LocalCacheData>(); // 类型建议用抽象父类兼容性更好
private static class LocalCacheData{
private static class LocalCacheData {
private String key; private String key;
private Object val; private Object val;
private long timeoutTime; private long timeoutTime;
@ -59,13 +60,13 @@ public class LocalCacheUtil {
* @param cacheTime * @param cacheTime
* @return * @return
*/ */
public static boolean set(String key, Object val, long cacheTime){ public static boolean set(String key, Object val, long cacheTime) {
// clean timeout cache, before set new cache (avoid cache too much) // clean timeout cache, before set new cache (avoid cache too much)
cleanTimeoutCache(); cleanTimeoutCache();
// set new cache // set new cache
if (key==null || key.trim().length()==0) { if (key == null || key.trim().length() == 0) {
return false; return false;
} }
if (val == null) { if (val == null) {
@ -86,8 +87,8 @@ public class LocalCacheUtil {
* @param key * @param key
* @return * @return
*/ */
public static boolean remove(String key){ public static boolean remove(String key) {
if (key==null || key.trim().length()==0) { if (key == null || key.trim().length() == 0) {
return false; return false;
} }
cacheRepository.remove(key); cacheRepository.remove(key);
@ -100,12 +101,12 @@ public class LocalCacheUtil {
* @param key * @param key
* @return * @return
*/ */
public static Object get(String key){ public static Object get(String key) {
if (key==null || key.trim().length()==0) { if (key == null || key.trim().length() == 0) {
return null; return null;
} }
LocalCacheData localCacheData = cacheRepository.get(key); LocalCacheData localCacheData = cacheRepository.get(key);
if (localCacheData!=null && System.currentTimeMillis()<localCacheData.getTimeoutTime()) { if (localCacheData != null && System.currentTimeMillis() < localCacheData.getTimeoutTime()) {
return localCacheData.getVal(); return localCacheData.getVal();
} else { } else {
remove(key); remove(key);
@ -118,11 +119,11 @@ public class LocalCacheUtil {
* *
* @return * @return
*/ */
public static boolean cleanTimeoutCache(){ public static boolean cleanTimeoutCache() {
if (!cacheRepository.keySet().isEmpty()) { if (!cacheRepository.keySet().isEmpty()) {
for (String key: cacheRepository.keySet()) { for (String key : cacheRepository.keySet()) {
LocalCacheData localCacheData = cacheRepository.get(key); LocalCacheData localCacheData = cacheRepository.get(key);
if (localCacheData!=null && System.currentTimeMillis()>=localCacheData.getTimeoutTime()) { if (localCacheData != null && System.currentTimeMillis() >= localCacheData.getTimeoutTime()) {
cacheRepository.remove(key); cacheRepository.remove(key);
} }
} }

View File

@ -26,12 +26,13 @@ public class LoginService {
private XxlJobUserDao xxlJobUserDao; private XxlJobUserDao xxlJobUserDao;
private String makeToken(XxlJobUser xxlJobUser){ private String makeToken(XxlJobUser xxlJobUser) {
String tokenJson = JacksonUtil.writeValueAsString(xxlJobUser); String tokenJson = JacksonUtil.writeValueAsString(xxlJobUser);
String tokenHex = new BigInteger(tokenJson.getBytes()).toString(16); String tokenHex = new BigInteger(tokenJson.getBytes()).toString(16);
return tokenHex; return tokenHex;
} }
private XxlJobUser parseToken(String tokenHex){
private XxlJobUser parseToken(String tokenHex) {
XxlJobUser xxlJobUser = null; XxlJobUser xxlJobUser = null;
if (tokenHex != null) { if (tokenHex != null) {
String tokenJson = new String(new BigInteger(tokenHex, 16).toByteArray()); // username_password(md5) String tokenJson = new String(new BigInteger(tokenHex, 16).toByteArray()); // username_password(md5)
@ -41,10 +42,10 @@ public class LoginService {
} }
public ReturnT<String> login(HttpServletRequest request, HttpServletResponse response, String username, String password, boolean ifRemember){ public ReturnT<String> login(HttpServletRequest request, HttpServletResponse response, String username, String password, boolean ifRemember) {
// param // param
if (username==null || username.trim().length()==0 || password==null || password.trim().length()==0){ if (username == null || username.trim().length() == 0 || password == null || password.trim().length() == 0) {
return new ReturnT<String>(500, I18nUtil.getString("login_param_empty")); return new ReturnT<String>(500, I18nUtil.getString("login_param_empty"));
} }
@ -71,7 +72,7 @@ public class LoginService {
* @param request * @param request
* @param response * @param response
*/ */
public ReturnT<String> logout(HttpServletRequest request, HttpServletResponse response){ public ReturnT<String> logout(HttpServletRequest request, HttpServletResponse response) {
CookieUtil.remove(request, response, LOGIN_IDENTITY_KEY); CookieUtil.remove(request, response, LOGIN_IDENTITY_KEY);
return ReturnT.SUCCESS; return ReturnT.SUCCESS;
} }
@ -82,7 +83,7 @@ public class LoginService {
* @param request * @param request
* @return * @return
*/ */
public XxlJobUser ifLogin(HttpServletRequest request, HttpServletResponse response){ public XxlJobUser ifLogin(HttpServletRequest request, HttpServletResponse response) {
String cookieToken = CookieUtil.getValue(request, LOGIN_IDENTITY_KEY); String cookieToken = CookieUtil.getValue(request, LOGIN_IDENTITY_KEY);
if (cookieToken != null) { if (cookieToken != null) {
XxlJobUser cookieUser = null; XxlJobUser cookieUser = null;
@ -103,8 +104,5 @@ public class LoginService {
return null; return null;
} }
public static void main(String[] args) {
System.out.println("121312");
}
} }

View File

@ -52,9 +52,9 @@ public class XxlJobServiceImpl implements XxlJobService {
// package result // package result
Map<String, Object> maps = new HashMap<String, Object>(); Map<String, Object> maps = new HashMap<String, Object>();
maps.put("recordsTotal" , list_count); // 总记录数 maps.put("recordsTotal", list_count); // 总记录数
maps.put("recordsFiltered" , list_count); // 过滤后的总记录数 maps.put("recordsFiltered", list_count); // 过滤后的总记录数
maps.put("data" , list); // 分页列表 maps.put("data", list); // 分页列表
return maps; return maps;
} }
@ -105,7 +105,7 @@ public class XxlJobServiceImpl implements XxlJobService {
} }
// fix "\r" in shell // fix "\r" in shell
if (GlueTypeEnum.GLUE_SHELL == GlueTypeEnum.match(jobInfo.getGlueType()) && jobInfo.getGlueSource() != null) { if (GlueTypeEnum.GLUE_SHELL == GlueTypeEnum.match(jobInfo.getGlueType()) && jobInfo.getGlueSource() != null) {
jobInfo.setGlueSource(jobInfo.getGlueSource().replaceAll("\r" , "")); jobInfo.setGlueSource(jobInfo.getGlueSource().replaceAll("\r", ""));
} }
// valid advanced // valid advanced
@ -373,10 +373,10 @@ public class XxlJobServiceImpl implements XxlJobService {
int executorCount = executorAddressSet.size(); int executorCount = executorAddressSet.size();
Map<String, Object> dashboardMap = new HashMap<String, Object>(); Map<String, Object> dashboardMap = new HashMap<String, Object>();
dashboardMap.put("jobInfoCount" , jobInfoCount); dashboardMap.put("jobInfoCount", jobInfoCount);
dashboardMap.put("jobLogCount" , jobLogCount); dashboardMap.put("jobLogCount", jobLogCount);
dashboardMap.put("jobLogSuccessCount" , jobLogSuccessCount); dashboardMap.put("jobLogSuccessCount", jobLogSuccessCount);
dashboardMap.put("executorCount" , executorCount); dashboardMap.put("executorCount", executorCount);
return dashboardMap; return dashboardMap;
} }
@ -420,14 +420,14 @@ public class XxlJobServiceImpl implements XxlJobService {
} }
Map<String, Object> result = new HashMap<String, Object>(); Map<String, Object> result = new HashMap<String, Object>();
result.put("triggerDayList" , triggerDayList); result.put("triggerDayList", triggerDayList);
result.put("triggerDayCountRunningList" , triggerDayCountRunningList); result.put("triggerDayCountRunningList", triggerDayCountRunningList);
result.put("triggerDayCountSucList" , triggerDayCountSucList); result.put("triggerDayCountSucList", triggerDayCountSucList);
result.put("triggerDayCountFailList" , triggerDayCountFailList); result.put("triggerDayCountFailList", triggerDayCountFailList);
result.put("triggerCountRunningTotal" , triggerCountRunningTotal); result.put("triggerCountRunningTotal", triggerCountRunningTotal);
result.put("triggerCountSucTotal" , triggerCountSucTotal); result.put("triggerCountSucTotal", triggerCountSucTotal);
result.put("triggerCountFailTotal" , triggerCountFailTotal); result.put("triggerCountFailTotal", triggerCountFailTotal);
return new ReturnT<Map<String, Object>>(result); return new ReturnT<Map<String, Object>>(result);
} }

View File

@ -1,6 +1,6 @@
admin_name=Scheduling Center admin_name=Scheduling Center
admin_name_full=Distributed Task Scheduling Platform XXL-JOB admin_name_full=Distributed Task Scheduling Platform XXL-JOB
admin_version=2.3.0 admin_version=2.3.1
admin_i18n=en admin_i18n=en
## system ## system

View File

@ -1,6 +1,6 @@
admin_name=任务调度中心 admin_name=任务调度中心
admin_name_full=分布式任务调度平台XXL-JOB admin_name_full=分布式任务调度平台XXL-JOB
admin_version=2.3.0 admin_version=2.3.1
admin_i18n= admin_i18n=
## system ## system

View File

@ -1,6 +1,6 @@
admin_name=任務調度中心 admin_name=任務調度中心
admin_name_full=分布式任務調度平臺XXL-JOB admin_name_full=分布式任務調度平臺XXL-JOB
admin_version=2.3.0 admin_version=2.3.1
admin_i18n= admin_i18n=
## system ## system