This commit is contained in:
Looly
2020-06-03 18:15:33 +08:00
parent 93951af07e
commit 8e2f63d576
5 changed files with 20 additions and 8 deletions

View File

@@ -1,9 +1,6 @@
package cn.hutool.cron;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import cn.hutool.core.exceptions.UtilException;
import cn.hutool.core.io.resource.NoResourceException;
import cn.hutool.cron.pattern.CronPattern;
@@ -11,6 +8,9 @@ import cn.hutool.cron.task.Task;
import cn.hutool.setting.Setting;
import cn.hutool.setting.SettingRuntimeException;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
* 定时任务工具类<br>
* 此工具持有一个全局{@link Scheduler},所有定时任务在同一个调度器中执行<br>
@@ -183,7 +183,7 @@ public class CronUtil {
}
if (scheduler.isStarted()) {
//关闭并清除已有任务
scheduler.stop(true);
stop();
}
} finally {
lock.unlock();
@@ -199,7 +199,7 @@ public class CronUtil {
* 停止
*/
public static void stop() {
scheduler.stop();
scheduler.stop(true);
}
}

View File

@@ -415,7 +415,7 @@ public class Scheduler implements Serializable {
* 停止定时任务<br>
* 此方法调用后会将定时器进程立即结束,如果为守护线程模式,则正在执行的作业也会自动结束,否则作业线程将在执行完成后结束。
*
* @param clearTasks 是否清除有任务
* @param clearTasks 是否清除有任务
* @return this
* @since 4.1.17
*/