add ProxySelector

This commit is contained in:
Looly
2024-11-29 17:21:08 +08:00
parent 5b129a1a8f
commit c2ea26e40d
19 changed files with 252 additions and 156 deletions

View File

@@ -26,12 +26,12 @@ public class AddAndRemoveMainTest {
CronUtil.setMatchSecond(true);
CronUtil.start(false);
CronUtil.getScheduler().clear();
final String id = CronUtil.schedule("*/2 * * * * *", (Runnable) () -> Console.log("task running : 2s"));
final String id = CronUtil.schedule("*/2 * * * * *", () -> Console.log("task running : 2s"));
ThreadUtil.sleep(3000);
CronUtil.remove(id);
Console.log("Task Removed");
CronUtil.schedule("*/3 * * * * *", (Runnable) () -> Console.log("New task add running : 3s"));
CronUtil.schedule("*/3 * * * * *", () -> Console.log("New task add running : 3s"));
Console.log("New Task added.");
}
}

View File

@@ -86,7 +86,8 @@ public class CronTest {
@Test
@Disabled
public void addAndRemoveTest() {
final String id = CronUtil.schedule("*/2 * * * * *", (Runnable) () -> Console.log("task running : 2s"));
final String id = CronUtil.schedule("*/2 * * * * *",
() -> Console.log("task running : 2s"));
Console.log(id);
CronUtil.remove(id);

View File

@@ -0,0 +1,16 @@
package org.dromara.hutool.cron.demo;
import org.dromara.hutool.core.lang.Console;
import org.dromara.hutool.cron.CronUtil;
public class SimpleDemo {
public static void main(String[] args) {
// 打开秒匹配
CronUtil.setMatchSecond(true);
// 添加任务
CronUtil.schedule("*/2 * * * * *",
() -> Console.log("Hutool task running!"));
// 启动
CronUtil.start();
}
}

View File

@@ -0,0 +1,5 @@
/**
* 定时任务示例
*
*/
package org.dromara.hutool.cron.demo;