Package io.servicetalk.concurrent.api
Interface Executor
- All Superinterfaces:
AsyncCloseable,Executor,ListenableAsyncCloseable,TimeSource
- All Known Subinterfaces:
EventLoopAwareNettyIoExecutor,IoExecutor,NettyIoExecutor
- All Known Implementing Classes:
DelegatingExecutor
A general abstraction to execute immediate and delayed tasks.
Long running tasks
Executor implementations are expected to run long-running (blocking) tasks which may depend on other tasks
submitted to the same Executor instance.
In order to avoid deadlocks, it is generally a good idea to not allow task queuing in the Executor.-
Method Summary
Modifier and TypeMethodDescriptiondefault CompletableCreate a newCompletablethat executes the passedRunnableon each subscribe.default <T> Single<T>default <T> Single<T>submitCallable(Supplier<? extends Callable<? extends T>> callableSupplier) default CompletablesubmitRunnable(Supplier<Runnable> runnableSupplier) Creates a newCompletablethat creates and executes aRunnablewhen subscribed to.default CompletableCreates a newCompletablethat will complete after the time duration expires.default CompletableCreates a newCompletablethat will complete after the time duration expires.Methods inherited from interface io.servicetalk.concurrent.api.AsyncCloseable
closeAsync, closeAsyncGracefullyMethods inherited from interface io.servicetalk.concurrent.Executor
currentTime, execute, schedule, scheduleMethods inherited from interface io.servicetalk.concurrent.api.ListenableAsyncCloseable
onClose, onClosing
-
Method Details
-
timer
Creates a newCompletablethat will complete after the time duration expires.- Parameters:
delay- The time duration which is allowed to elapse between subscribe and termination.unit- The units forduration.- Returns:
- a new
Completablethat will complete after the time duration expires. - See Also:
-
timer
Creates a newCompletablethat will complete after the time duration expires.- Parameters:
delay- The time duration which is allowed to elapse between subscribe and termination.- Returns:
- a new
Completablethat will complete after the time duration expires. - See Also:
-
submit
Create a newCompletablethat executes the passedRunnableon each subscribe.- Parameters:
runnable- TheRunnableto execute on each subscribe.- Returns:
- a new
Completablethat executes aRunnableon each subscribe.
-
submitRunnable
Creates a newCompletablethat creates and executes aRunnablewhen subscribed to.- Parameters:
runnableSupplier-Supplierto create a newRunnablefor every subscribe of the returnedCompletable.- Returns:
- A new
Completablethat creates and executes a newRunnableusingrunnableSupplierfor every subscribe.
-
submit
-
submitCallable
-