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
Executor
implementations are expected to run long running (blocking) tasks which may depend on other tasks submitted to the sameExecutor
instance. 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 Completable
submit(java.lang.Runnable runnable)
Create a newCompletable
that executes the passedRunnable
on each subscribe.default <T> Single<T>
submit(java.util.concurrent.Callable<? extends T> callable)
Creates a newSingle
that creates and executes the passedCallable
when subscribed to.default <T> Single<T>
submitCallable(java.util.function.Supplier<? extends java.util.concurrent.Callable<? extends T>> callableSupplier)
default Completable
submitRunnable(java.util.function.Supplier<java.lang.Runnable> runnableSupplier)
Creates a newCompletable
that creates and executes aRunnable
when subscribed to.default Completable
timer(long delay, java.util.concurrent.TimeUnit unit)
Creates a newCompletable
that will complete after the time duration expires.default Completable
timer(java.time.Duration delay)
Creates a newCompletable
that 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 newCompletable
that 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
Completable
that will complete after the time duration expires. - See Also:
- ReactiveX Timer.
-
timer
default Completable timer(java.time.Duration delay)
Creates a newCompletable
that will complete after the time duration expires.- Parameters:
delay
- The time duration which is allowed to elapse between subscribe and termination.- Returns:
- a new
Completable
that will complete after the time duration expires. - See Also:
- ReactiveX Timer.
-
submit
default Completable submit(java.lang.Runnable runnable)
Create a newCompletable
that executes the passedRunnable
on each subscribe.- Parameters:
runnable
- TheRunnable
to execute on each subscribe.- Returns:
- a new
Completable
that executes aRunnable
on each subscribe.
-
submitRunnable
default Completable submitRunnable(java.util.function.Supplier<java.lang.Runnable> runnableSupplier)
Creates a newCompletable
that creates and executes aRunnable
when subscribed to.- Parameters:
runnableSupplier
-Supplier
to create a newRunnable
for every subscribe of the returnedCompletable
.- Returns:
- A new
Completable
that creates and executes a newRunnable
usingrunnableSupplier
for every subscribe.
-
submit
default <T> Single<T> submit(java.util.concurrent.Callable<? extends T> callable)
Creates a newSingle
that creates and executes the passedCallable
when subscribed to.
-
submitCallable
default <T> Single<T> submitCallable(java.util.function.Supplier<? extends java.util.concurrent.Callable<? extends T>> callableSupplier)
-
-