mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -10,23 +10,12 @@ public class AddAndRemoveMainTest {
|
||||
CronUtil.setMatchSecond(true);
|
||||
CronUtil.start(false);
|
||||
CronUtil.getScheduler().clear();
|
||||
String id = CronUtil.schedule("*/2 * * * * *", new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Console.log("task running : 2s");
|
||||
}
|
||||
});
|
||||
String id = CronUtil.schedule("*/2 * * * * *", (Runnable) () -> Console.log("task running : 2s"));
|
||||
ThreadUtil.sleep(3000);
|
||||
CronUtil.remove(id);
|
||||
Console.log("Task Removed");
|
||||
id = CronUtil.schedule("*/3 * * * * *", new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Console.log("New task add running : 3s");
|
||||
}
|
||||
});
|
||||
CronUtil.schedule("*/3 * * * * *", (Runnable) () -> Console.log("New task add running : 3s"));
|
||||
Console.log("New Task added.");
|
||||
}
|
||||
}
|
||||
|
@@ -13,7 +13,7 @@ import cn.hutool.core.util.IdUtil;
|
||||
*/
|
||||
public class TestJob {
|
||||
|
||||
private String jobId = IdUtil.simpleUUID();
|
||||
private final String jobId = IdUtil.simpleUUID();
|
||||
|
||||
/**
|
||||
* 执行定时任务内容
|
||||
|
Reference in New Issue
Block a user