Package top.focess.qq.api.schedule
Class Schedulers
- java.lang.Object
-
- top.focess.qq.api.schedule.Schedulers
-
public class Schedulers extends Object
Used to create Scheduler. The scheduler factory.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclose(Plugin plugin)Close all the schedulers belonging to the pluginstatic booleancloseAll()Close all the schedulersstatic @NotNull top.focess.scheduler.SchedulernewFocessScheduler(@NotNull Plugin plugin)New a FocessScheduler, the scheduler will run all tasks in time order.static @NotNull top.focess.scheduler.SchedulernewFocessScheduler(@NotNull Plugin plugin, @NotNull String name)New a FocessScheduler, the scheduler will run all tasks in time order.static @NotNull top.focess.scheduler.SchedulernewThreadPoolScheduler(@NotNull Plugin plugin, int poolSize)New a ThreadPoolScheduler, the scheduler can run tasks in parallel.static @NotNull top.focess.scheduler.SchedulernewThreadPoolScheduler(@NotNull Plugin plugin, int poolSize, boolean immediate, @NotNull String name)New a ThreadPoolScheduler, the scheduler can run tasks in parallel.
-
-
-
Method Detail
-
newFocessScheduler
@NotNull @Contract("_ -> new") public static @NotNull top.focess.scheduler.Scheduler newFocessScheduler(@NotNull @NotNull Plugin plugin)New a FocessScheduler, the scheduler will run all tasks in time order. For example, if the finish-time of the last task is after the start-time of the next task, the next task will only be executed after the last task is finished. As a result, the task running in this scheduler cannot be cancelled if it is already running.- Parameters:
plugin- the plugin- Returns:
- a FocessScheduler
- See Also:
newFocessScheduler(Plugin)
-
newFocessScheduler
@NotNull @Contract("_, _ -> new") public static @NotNull top.focess.scheduler.Scheduler newFocessScheduler(@NotNull @NotNull Plugin plugin, @NotNull @NotNull String name)New a FocessScheduler, the scheduler will run all tasks in time order. For example, if the finish-time of the last task is after the start-time of the next task, the next task will only be executed after the last task is finished. As a result, the task running in this scheduler cannot be cancelled if it is already running.- Parameters:
plugin- the pluginname- the scheduler name- Returns:
- a FocessScheduler
- See Also:
newFocessScheduler(Plugin)
-
newThreadPoolScheduler
@NotNull @Contract("_, _ -> new") public static @NotNull top.focess.scheduler.Scheduler newThreadPoolScheduler(@NotNull @NotNull Plugin plugin, int poolSize)New a ThreadPoolScheduler, the scheduler can run tasks in parallel. The next task will be executed when there is an available thread. As a result, the task running in this scheduler can be cancelled if it is already running.- Parameters:
plugin- the pluginpoolSize- the thread pool size- Returns:
- a ThreadPoolScheduler
- See Also:
newThreadPoolScheduler(Plugin, int, boolean, String)
-
newThreadPoolScheduler
@NotNull @Contract("_, _, _, _ -> new") public static @NotNull top.focess.scheduler.Scheduler newThreadPoolScheduler(@NotNull @NotNull Plugin plugin, int poolSize, boolean immediate, @NotNull @NotNull String name)New a ThreadPoolScheduler, the scheduler can run tasks in parallel. The next task will be executed immediately if the immediate is true, otherwise the next task will be executed when there is an available thread. As a result, the task running in this scheduler can be cancelled if it is already running.- Parameters:
plugin- the pluginpoolSize- the thread pool sizeimmediate- true if the task should run immediately when there is not enough threads, false otherwisename- the scheduler name- Returns:
- a ThreadPoolScheduler
- See Also:
newThreadPoolScheduler(Plugin, int)
-
close
public static void close(Plugin plugin)
Close all the schedulers belonging to the plugin- Parameters:
plugin- the plugin
-
closeAll
public static boolean closeAll()
Close all the schedulers- Returns:
- true if there are some schedulers not belonging to MainPlugin not been closed, false otherwise
-
-