任务失败告警邮件发送逻辑优化

master
xuxueli 6 years ago
parent 878df30bbc
commit 2016fa7cea
  1. 3
      doc/XXL-JOB官方文档.md
  2. 21
      xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobFailMonitorHelper.java
  3. 2
      xxl-job-core/src/main/java/com/xxl/job/core/thread/ExecutorRegistryThread.java
  4. 2
      xxl-job-core/src/main/java/com/xxl/job/core/thread/JobLogFileCleanThread.java

@ -1428,7 +1428,8 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
- 14、新增Class的加载缓存,解决频繁加载Class会使jvm的方法区空间不足导致OOM的问题;
- 15、调整首页报表默认区间为本周,避免日志量太大查询缓慢;
- 16、LRU路由更新不及时问题修复;
- 17、[迭代中]任务线程隔离:
- 17、任务失败告警邮件发送逻辑优化;
- 18、[迭代中]任务线程隔离:
- 执行器测异步响应,不存在阻塞不需要隔离;
- 调度中心共用单一调度线程池,可能导致调度阻塞需要线程隔离;调度线程池拆分为Fast/Slow两个,针对调度较慢的执行器地址请求,降级使用Slow线程池;考虑是否可以任务级隔离线程池;

@ -150,6 +150,7 @@ public class JobFailMonitorHelper {
// send monitor email
if (info!=null && info.getAlarmEmail()!=null && info.getAlarmEmail().trim().length()>0) {
// alarmContent
String alarmContent = "Alarm Job LogId=" + jobLog.getId();
if (jobLog.getTriggerCode() != ReturnT.SUCCESS_CODE) {
alarmContent += "<br>TriggerMsg=<br>" + jobLog.getTriggerMsg();
@ -158,18 +159,18 @@ public class JobFailMonitorHelper {
alarmContent += "<br>HandleCode=" + jobLog.getHandleMsg();
}
// email info
XxlJobGroup group = XxlJobAdminConfig.getAdminConfig().getXxlJobGroupDao().load(Integer.valueOf(info.getJobGroup()));
String personal = I18nUtil.getString("admin_name_full");
String title = I18nUtil.getString("jobconf_monitor");
String content = MessageFormat.format(mailBodyTemplate,
group!=null?group.getTitle():"null",
info.getId(),
info.getJobDesc(),
alarmContent);
Set<String> emailSet = new HashSet<String>(Arrays.asList(info.getAlarmEmail().split(",")));
for (String email: emailSet) {
XxlJobGroup group = XxlJobAdminConfig.getAdminConfig().getXxlJobGroupDao().load(Integer.valueOf(info.getJobGroup()));
String personal = I18nUtil.getString("admin_name_full");
String title = I18nUtil.getString("jobconf_monitor");
String content = MessageFormat.format(mailBodyTemplate,
group!=null?group.getTitle():"null",
info.getId(),
info.getJobDesc(),
alarmContent);
// make mail
try {

@ -13,7 +13,7 @@ import java.util.concurrent.TimeUnit;
/**
* Created by xuxueli on 17/3/2.
*/
public class ExecutorRegistryThread extends Thread {
public class ExecutorRegistryThread {
private static Logger logger = LoggerFactory.getLogger(ExecutorRegistryThread.class);
private static ExecutorRegistryThread instance = new ExecutorRegistryThread();

@ -17,7 +17,7 @@ import java.util.concurrent.TimeUnit;
*
* @author xuxueli 2017-12-29 16:23:43
*/
public class JobLogFileCleanThread extends Thread {
public class JobLogFileCleanThread {
private static Logger logger = LoggerFactory.getLogger(JobLogFileCleanThread.class);
private static JobLogFileCleanThread instance = new JobLogFileCleanThread();

Loading…
Cancel
Save