ScheduleManager优化

This commit is contained in:
redkale
2024-01-02 16:23:12 +08:00
parent 34a03b0e26
commit 95539580a7

View File

@@ -162,7 +162,7 @@ public class ScheduleManagerService implements ScheduleManager, Service {
} while ((clazz = clazz.getSuperclass()) != Object.class);
//开始执行定时任务
if (enabled && !tasks.isEmpty()) {
tasks.forEach((name, task) -> task.start());
tasks.forEach((name, task) -> task.init());
refTaskMap.put(ref, new ArrayList<>(tasks.values()));
}
} finally {
@@ -360,6 +360,10 @@ public class ScheduleManagerService implements ScheduleManager, Service {
this.event = method.getParameterCount() == 0 ? null : new ScheduleEvent();
}
public void init() {
start();
}
public abstract void start();
public void stop() {