Package io.servicetalk.concurrent.api
Interface Executor
-
- All Superinterfaces:
AsyncCloseable,Executor,ListenableAsyncCloseable
- All Known Implementing Classes:
DelegatingExecutor,OffloaderAwareExecutor,TestExecutor
public interface Executor extends Executor, ListenableAsyncCloseable
A general abstraction to execute immediate and delayed tasks.Long running tasks
Executorimplementations are expected to run long running (blocking) tasks which may depend on other tasks submitted to the sameExecutorinstance. In order to avoid deadlocks, it is generally a good idea to not allow task queuing in theExecutor.
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default Completablesubmit(java.lang.Runnable runnable)Create a newCompletablethat executes the passedRunnableon each subscribe.default <T> Single<T>submit(java.util.concurrent.Callable<? extends T> callable)Creates a newSinglethat creates and executes the passedCallablewhen subscribed to.default <T> Single<T>submitCallable(java.util.function.Supplier<? extends java.util.concurrent.Callable<? extends T>> callableSupplier)default CompletablesubmitRunnable(java.util.function.Supplier<java.lang.Runnable> runnableSupplier)Creates a newCompletablethat creates and executes aRunnablewhen subscribed to.default Completabletimer(long delay, java.util.concurrent.TimeUnit unit)Creates a newCompletablethat will complete after the time duration expires.default Completabletimer(java.time.Duration delay)Creates a newCompletablethat will complete after the time duration expires.-
Methods inherited from interface io.servicetalk.concurrent.api.AsyncCloseable
closeAsync, closeAsyncGracefully
-
Methods inherited from interface io.servicetalk.concurrent.api.ListenableAsyncCloseable
onClose
-
-
-
-
Method Detail
-
timer
default Completable timer(long delay, java.util.concurrent.TimeUnit unit)
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:
- ReactiveX Timer.
-
timer
default Completable timer(java.time.Duration delay)
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:
- ReactiveX Timer.
-
submit
default Completable submit(java.lang.Runnable runnable)
Create a newCompletablethat executes the passedRunnableon each subscribe.- Parameters:
runnable- TheRunnableto execute on each subscribe.- Returns:
- a new
Completablethat executes aRunnableon each subscribe.
-
submitRunnable
default Completable submitRunnable(java.util.function.Supplier<java.lang.Runnable> runnableSupplier)
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
default <T> Single<T> submit(java.util.concurrent.Callable<? extends T> callable)
Creates a newSinglethat creates and executes the passedCallablewhen subscribed to.
-
submitCallable
default <T> Single<T> submitCallable(java.util.function.Supplier<? extends java.util.concurrent.Callable<? extends T>> callableSupplier)
-
-