mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
添加 junit 测试
This commit is contained in:
parent
c73ea53f8f
commit
57212bfdba
@ -97,10 +97,10 @@ public class SpringCronUtil {
|
||||
* @return 是否移除成功,{@code false}表示未找到对应ID的任务
|
||||
*/
|
||||
public static boolean cancel(Serializable schedulerId) {
|
||||
ScheduledFuture<?> future = getScheduledFuture(schedulerId);
|
||||
if (future == null) {
|
||||
if (!TASK_FUTURE.containsKey(schedulerId)) {
|
||||
return false;
|
||||
}
|
||||
ScheduledFuture<?> future = TASK_FUTURE.get(schedulerId);
|
||||
boolean cancel = future.cancel(false);
|
||||
if (cancel) {
|
||||
TASK_FUTURE.remove(schedulerId);
|
||||
@ -121,15 +121,6 @@ public class SpringCronUtil {
|
||||
return taskScheduler;
|
||||
}
|
||||
|
||||
/**
|
||||
* 可在项目中 进行细粒度控制
|
||||
*
|
||||
* @return 获得ScheduledFuture对象
|
||||
*/
|
||||
private static ScheduledFuture<?> getScheduledFuture(Serializable id) {
|
||||
return TASK_FUTURE.get(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得当前运行的所有任务
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user