Package org.polyfrost.oneconfig.utils.v1
Class Multithreading
java.lang.Object
org.polyfrost.oneconfig.utils.v1.Multithreading
Allows for easy multithreading.
Modified from Seraph by Scherso under LGPL-2.1 https://github.com/Scherso/Seraph/blob/master/LICENSE
-
Method Summary
Modifier and TypeMethodDescriptionstatic ExecutorServicestatic ScheduledExecutorServicestatic voidSchedules the runnable to run asynchronously after the specified delay.static Future<?> Submits the Runnable to the executor, making it run asynchronously.static voidRuns the provided runnables asynchronously.static ScheduledFuture<?> submitScheduled(Runnable runnable, long delay, TimeUnit timeUnit) Submits the Runnable to the executor after a delay, making it run asynchronously.
-
Method Details
-
submit
Runs the provided runnables asynchronously.- Parameters:
runnables- The runnables to run.- See Also:
-
submit
Submits the Runnable to the executor, making it run asynchronously.- Parameters:
runnable- The runnable to run.- Returns:
- The future representing the submitted runnable.
- See Also:
-
schedule
Schedules the runnable to run asynchronously after the specified delay.- Parameters:
runnable- The runnable to run.delay- The delay before the runnable is run.timeUnit- TheTimeUnitof the delay.- See Also:
-
submitScheduled
Submits the Runnable to the executor after a delay, making it run asynchronously.- Parameters:
runnable- The runnable to run.delay- The delay before the runnable is run.timeUnit- TheTimeUnitof the delay.- Returns:
- The future representing the submitted runnable.
- See Also:
-
getExecutor
-
getScheduledExecutor
-