|
@@ -119,6 +119,7 @@ public class AppTaskService {
|
|
|
List<AppTaskBo> l2 = retryAppTaskMapper.getRetryAppTasks(AppTaskStatusEnum.RUNNING.value);
|
|
|
l2.forEach(t -> {
|
|
|
ScheduledFuture<?> future = taskScheduler.schedule(() -> runTask(t), t.getRetryTime());
|
|
|
+ log.debug("getActiveCount: {}", taskScheduler.getActiveCount());
|
|
|
RETRY_TASKS.put(t.getTaskId(), future);
|
|
|
});
|
|
|
}
|
|
@@ -151,6 +152,7 @@ public class AppTaskService {
|
|
|
removeTask(t.getTaskId());
|
|
|
CronTrigger cronTrigger = new CronTrigger(t.getCron());
|
|
|
ScheduledFuture<?> future = taskScheduler.schedule(() -> runTask(t), cronTrigger);
|
|
|
+ log.debug("getActiveCount: {}", taskScheduler.getActiveCount());
|
|
|
TASKS.put(t.getTaskId(), future);
|
|
|
}
|
|
|
|
|
@@ -229,9 +231,11 @@ public class AppTaskService {
|
|
|
sendMessage(t, content);
|
|
|
};
|
|
|
if (t.getTaskTimeout() > 0) {
|
|
|
- CompletableFuture.runAsync(runnable).get(t.getTaskTimeout(), TimeUnit.SECONDS);
|
|
|
+ CompletableFuture.runAsync(runnable, taskScheduler).get(t.getTaskTimeout(), TimeUnit.SECONDS);
|
|
|
+ log.debug("getActiveCount: {}", taskScheduler.getActiveCount());
|
|
|
} else {
|
|
|
- CompletableFuture.runAsync(runnable).join();
|
|
|
+ CompletableFuture.runAsync(runnable, taskScheduler).join();
|
|
|
+ log.debug("getActiveCount: {}", taskScheduler.getActiveCount());
|
|
|
}
|
|
|
} catch (InterruptedException e) {
|
|
|
appTaskLogPo.setStatus(0);
|
|
@@ -289,6 +293,7 @@ public class AppTaskService {
|
|
|
iRetryAppTaskService.saveOrUpdate(retryAppTaskPo);
|
|
|
t.setRetryTimes(t.getRetryTimes() + 1);
|
|
|
ScheduledFuture<?> future = taskScheduler.schedule(() -> runTask(t), instant);
|
|
|
+ log.debug("getActiveCount: {}", taskScheduler.getActiveCount());
|
|
|
RETRY_TASKS.put(t.getTaskId(), future);
|
|
|
}
|
|
|
} catch (Exception e) {
|