mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-12-07 01:28:34 +08:00
fix code
This commit is contained in:
parent
04bdaa4f4b
commit
9f1e240b25
@ -104,8 +104,7 @@ public class ListUtil {
|
|||||||
if (null == iterable) {
|
if (null == iterable) {
|
||||||
return of(isLinked);
|
return of(isLinked);
|
||||||
}
|
}
|
||||||
if (iterable instanceof Collection) {
|
if (iterable instanceof final Collection<T> collection) {
|
||||||
final Collection<T> collection = (Collection<T>) iterable;
|
|
||||||
return isLinked ? new LinkedList<>(collection) : new ArrayList<>(collection);
|
return isLinked ? new LinkedList<>(collection) : new ArrayList<>(collection);
|
||||||
}
|
}
|
||||||
return of(isLinked, iterable.iterator());
|
return of(isLinked, iterable.iterator());
|
||||||
@ -117,12 +116,12 @@ public class ListUtil {
|
|||||||
*
|
*
|
||||||
* @param <T> 集合元素类型
|
* @param <T> 集合元素类型
|
||||||
* @param isLinked 是否新建LinkedList
|
* @param isLinked 是否新建LinkedList
|
||||||
* @param enumration {@link Enumeration}
|
* @param enumeration {@link Enumeration}
|
||||||
* @return ArrayList对象
|
* @return ArrayList对象
|
||||||
* @since 3.0.8
|
* @since 3.0.8
|
||||||
*/
|
*/
|
||||||
public static <T> List<T> of(final boolean isLinked, final Enumeration<T> enumration) {
|
public static <T> List<T> of(final boolean isLinked, final Enumeration<T> enumeration) {
|
||||||
return of(isLinked, (Iterator<T>) new EnumerationIter<>(enumration));
|
return of(isLinked, (Iterator<T>) new EnumerationIter<>(enumeration));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package cn.hutool.v7.cron;
|
package cn.hutool.v7.cron;
|
||||||
|
|
||||||
|
import cn.hutool.v7.core.collection.ListUtil;
|
||||||
import cn.hutool.v7.cron.task.CronTask;
|
import cn.hutool.v7.cron.task.CronTask;
|
||||||
import cn.hutool.v7.cron.task.Task;
|
import cn.hutool.v7.cron.task.Task;
|
||||||
|
|
||||||
@ -26,7 +27,7 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 任务管理器,提供:
|
* 任务管理器,提供任务的全生命周期管理,提供:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>启动器管理</li>
|
* <li>启动器管理</li>
|
||||||
* <li>执行器管理</li>
|
* <li>执行器管理</li>
|
||||||
@ -51,6 +52,7 @@ public class TaskManager implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 构造
|
* 构造
|
||||||
|
*
|
||||||
* @param scheduler {@link Scheduler}
|
* @param scheduler {@link Scheduler}
|
||||||
*/
|
*/
|
||||||
public TaskManager(final Scheduler scheduler) {
|
public TaskManager(final Scheduler scheduler) {
|
||||||
@ -58,8 +60,19 @@ public class TaskManager implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// region ----- TaskLauncher
|
// region ----- TaskLauncher
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有启动器列表,不可修改
|
||||||
|
*
|
||||||
|
* @return 启动器列表
|
||||||
|
*/
|
||||||
|
public List<TaskLauncher> getLaunchers() {
|
||||||
|
return ListUtil.view(this.launchers);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启动 TaskLauncher
|
* 启动 TaskLauncher
|
||||||
|
*
|
||||||
* @param millis 触发事件的毫秒数
|
* @param millis 触发事件的毫秒数
|
||||||
* @return {@link TaskLauncher}
|
* @return {@link TaskLauncher}
|
||||||
*/
|
*/
|
||||||
@ -74,6 +87,7 @@ public class TaskManager implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 启动器启动完毕,启动完毕后从执行器列表中移除
|
* 启动器启动完毕,启动完毕后从执行器列表中移除
|
||||||
|
*
|
||||||
* @param launcher 启动器 {@link TaskLauncher}
|
* @param launcher 启动器 {@link TaskLauncher}
|
||||||
*/
|
*/
|
||||||
protected void notifyLauncherCompleted(final TaskLauncher launcher) {
|
protected void notifyLauncherCompleted(final TaskLauncher launcher) {
|
||||||
@ -84,14 +98,15 @@ public class TaskManager implements Serializable {
|
|||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
// region ----- TaskExecutor
|
// region ----- TaskExecutor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有正在执行的任务调度执行器
|
* 获取所有正在执行的任务调度执行器,不可修改
|
||||||
*
|
*
|
||||||
* @return 任务执行器列表
|
* @return 任务执行器列表
|
||||||
* @since 4.6.7
|
* @since 4.6.7
|
||||||
*/
|
*/
|
||||||
public List<TaskExecutor> getExecutors() {
|
public List<TaskExecutor> getExecutors() {
|
||||||
return Collections.unmodifiableList(this.executors);
|
return ListUtil.view(this.executors);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user