Interface Executor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classExecutor.ExecutableFuture
-
Method Summary
Modifier and Type Method Description abstract UnitexecuteBlocking(Duration delay, Function0<Unit> runnable)Schedules a blocking task for execution on another thread. abstract UnitexecuteBlocking(Function0<Unit> runnable)Schedules a blocking task for execution on another thread. abstract <T extends Any> UnitexecuteBlocking(Callable<T> blocking, Function1<T, Unit> result)Execute a task to another thread. abstract <T extends Any> CompletableFuture<T>executeBlockingTask(Duration delay, Function0<T> task)Schedules a blocking task for execution on another thread. LongsetPeriodic(Duration delay, Function0<Unit> runnable)Schedules a periodic task. abstract LongsetPeriodic(Duration initialDelay, Duration delay, Function0<Unit> runnable)Schedules a periodic task. Unitexecute(Runnable command)<T extends Any> CompletableFuture<T>newIncompleteFuture()Returns an incomplete CompletableFuture which uses this executor for async methods that do not specify another executor -
-
Method Detail
-
executeBlocking
abstract Unit executeBlocking(Duration delay, Function0<Unit> runnable)
Schedules a blocking task for execution on another thread.
This method returns immediately, without waiting for the task to finish.
- Parameters:
delay- the time from now to delay executionrunnable- the task to run
-
executeBlocking
abstract Unit executeBlocking(Function0<Unit> runnable)
Schedules a blocking task for execution on another thread.
This method returns immediately, without waiting for the task to finish.
- Parameters:
runnable- the task to run
-
executeBlocking
abstract <T extends Any> Unit executeBlocking(Callable<T> blocking, Function1<T, Unit> result)
Execute a task to another thread. If an exception is thrown by the blocking function, null is passed to the result function.
This method returns immediately, without waiting for the task to finish.
- Parameters:
blocking- the task to runresult- the result handler
-
executeBlockingTask
abstract <T extends Any> CompletableFuture<T> executeBlockingTask(Duration delay, Function0<T> task)
Schedules a blocking task for execution on another thread.
This method returns immediately, without waiting for the task to finish.
The returned future will schedule any followup async task on this executor.
- Parameters:
delay- the time from now to delay executiontask- the task to run- Returns:
a CompletableFuture that is asynchronously completed with the given task
-
setPeriodic
Long setPeriodic(Duration delay, Function0<Unit> runnable)
Schedules a periodic task.
This method returns immediately, without waiting for the task to execute.
- Parameters:
delay- the delay before the first call, and between each following callrunnable- the task to run
-
setPeriodic
abstract Long setPeriodic(Duration initialDelay, Duration delay, Function0<Unit> runnable)
Schedules a periodic task.
This method returns immediately, without waiting for the task to execute.
- Parameters:
initialDelay- the delay before first calldelay- the delay between each other callrunnable- the task to run
-
newIncompleteFuture
<T extends Any> CompletableFuture<T> newIncompleteFuture()
Returns an incomplete CompletableFuture which uses this executor for async methods that do not specify another executor
-
-
-
-