forked from github/dataease
fix(X-Pack): 定时报告任务停止实例未停止
This commit is contained in:
parent
4096ef1045
commit
349bb2126d
@ -29,7 +29,8 @@ public class DeTaskExecutor {
|
||||
}
|
||||
|
||||
@XpackInteract(value = "xpackTaskExecutor", replace = true)
|
||||
public void init() {}
|
||||
public void init() {
|
||||
}
|
||||
|
||||
public void addOrUpdateTask(Long taskId, String cron, Long startTime, Long endTime) {
|
||||
if (CronUtils.taskExpire(endTime)) {
|
||||
@ -46,10 +47,14 @@ public class DeTaskExecutor {
|
||||
scheduleManager.addOrUpdateCronJob(jobKey, triggerKey, DeXpackScheduleJob.class, cron, new Date(startTime), end, jobDataMap);
|
||||
}
|
||||
|
||||
public void fireNow(Long taskId) throws Exception {
|
||||
public boolean fireNow(Long taskId) throws Exception {
|
||||
String key = taskId.toString();
|
||||
JobKey jobKey = new JobKey(key, JOB_GROUP);
|
||||
scheduleManager.fireNow(jobKey);
|
||||
if (scheduleManager.exist(jobKey)) {
|
||||
scheduleManager.fireNow(jobKey);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void addTempTask(Long taskId, Long startTime) {
|
||||
|
@ -431,4 +431,13 @@ public class ScheduleManager {
|
||||
scheduler.triggerJob(jobKey);
|
||||
}
|
||||
|
||||
public boolean exist(JobKey jobKey) {
|
||||
try {
|
||||
return scheduler.checkExists(jobKey);
|
||||
} catch (SchedulerException e) {
|
||||
LogUtil.error(e.getMessage(), new Throwable(e));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
2
de-xpack
2
de-xpack
@ -1 +1 @@
|
||||
Subproject commit 16f95eb5481cda834434b2c6f956b66a411ad67b
|
||||
Subproject commit 96a9aef239d74efa6d6e7c3780d42409b065ae2a
|
Loading…
Reference in New Issue
Block a user