public class Runners extends Runners
| Constructor and Description |
|---|
Runners() |
| Modifier and Type | Method and Description |
|---|---|
static Runner |
handlerRunner(HandlerThread thread)
Returns a runner employing the specified handler thread.
|
static Runner |
looperRunner(Looper looper)
Returns a runner employing the specified looper.
Note that, when the invocation runs in the looper thread, the executions with a delay of 0 will be performed synchronously, while the ones with a positive delay will be posted on the same thread. |
static Runner |
looperRunner(Looper looper,
Runner sameThreadRunner)
Returns a runner employing the specified looper.
Note that, based on the choice of the runner to be used when the invocation runs in the looper thread, waiting for results in the very same thread may result in a deadlock exception. |
static Runner |
mainRunner()
Returns the shared runner employing the main thread looper.
Note that, when the invocation runs in the main thread, the executions with a delay of 0 will be performed synchronously, while the ones with a positive delay will be posted on the main thread. |
static Runner |
myRunner()
Returns a runner employing the calling thread looper.
|
static Runner |
taskRunner()
Returns a runner employing async tasks.
|
static Runner |
taskRunner(Executor executor)
Returns a runner employing async tasks running on the specified executor.
|
dynamicPoolRunner, poolRunner, poolRunner, priorityRunner, scheduledRunner, sharedRunner, syncRunner, throttlingRunner@Nonnull public static Runner handlerRunner(@Nonnull HandlerThread thread)
thread - the thread.@Nonnull public static Runner looperRunner(@Nonnull Looper looper)
looper - the looper instance.@Nonnull public static Runner looperRunner(@Nonnull Looper looper, @Nullable Runner sameThreadRunner)
looper - the looper instance.sameThreadRunner - the runner to be used when the specified looper is called on its own
thread. If null, the invocation will be posted on the same looper.@Nonnull public static Runner mainRunner()
@Nonnull public static Runner myRunner()
@Nonnull public static Runner taskRunner()
@Nonnull public static Runner taskRunner(@Nullable Executor executor)
executor - the executor.