-
public class Schedulers
-
-
Method Summary
Modifier and Type Method Description static Scheduler
newThread()
Creates and returns a Scheduler that creates a new Thread for each unit of work. static Scheduler
computation()
Creates and returns a Scheduler intended for computational work. static Scheduler
io()
Creates and returns a Scheduler intended for IO-bound work. static void
reset()
Resets the current Schedulers instance.This will re-init the cached schedulers on the next usage,which can be useful in testing. static Scheduler
from(Executor executor)
Converts an Executor into a new Scheduler instance. -
-
Method Detail
-
newThread
static Scheduler newThread()
Creates and returns a Scheduler that creates a new Thread for each unit of work.
Unhandled errors will be delivered to the scheduler Thread's java.lang.Thread.UncaughtExceptionHandler.
-
computation
static Scheduler computation()
Creates and returns a Scheduler intended for computational work.
This can be used for event-loops, processing callbacks and other computational work.
Do not perform IO-bound work on this scheduler. Use io instead.
Unhandled errors will be delivered to the scheduler Thread's java.lang.Thread.UncaughtExceptionHandler.
-
io
static Scheduler io()
Creates and returns a Scheduler intended for IO-bound work.
The implementation is backed by an Executor thread-pool that will grow as needed.
This can be used for asynchronously performing blocking IO.
Do not perform computational work on this scheduler. Use computation instead.
Unhandled errors will be delivered to the scheduler Thread's java.lang.Thread.UncaughtExceptionHandler.
-
reset
static void reset()
Resets the current Schedulers instance.This will re-init the cached schedulers on the next usage,which can be useful in testing.
-
-
-
-