Class SchedulerExecutorPoolImpl
java.lang.Object
dev.rollczi.litecommands.scheduler.SchedulerExecutorPoolImpl
- All Implemented Interfaces:
Scheduler
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ExecutorServicecreateAsyncExecutor(String name, int pool) Create async executor.protected ExecutorServicecreateMainExecutor(String name) Create the main executor.voidshutdown()<T> CompletableFuture<T> supplyLater(SchedulerType type, Duration delay, ThrowingSupplier<T, Throwable> supplier) Runs the supplier in the specified thread after the specified delay
-
Field Details
-
CACHED_POOL
public static final int CACHED_POOL- See Also:
-
isMainThread
-
-
Constructor Details
-
SchedulerExecutorPoolImpl
-
SchedulerExecutorPoolImpl
-
-
Method Details
-
shutdown
public void shutdown() -
createMainExecutor
Create the main executor. In some cases, the main executor might never be used. We don't want to have to create a useless thread This may look like a premature optimization, but a typical server has 40+ plugins As the framework spreads, more and more of them can use LiteCommands, so we better handle this situation, there are practically no losses anyway To improve performance executor setisMainThreadto true.- Returns:
- the main executor. (Should have one thread)
-
createAsyncExecutor
Create async executor.- Returns:
- async executor.