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 Completable
Create a newCompletable
that executes the passedRunnable
on each subscribe.default <T> Single<T>
default <T> Single<T>
submitCallable
(Supplier<? extends Callable<? extends T>> callableSupplier) default Completable
submitRunnable
(Supplier<Runnable> runnableSupplier) Creates a newCompletable
that creates and executes aRunnable
when subscribed to.default Completable
Creates a newCompletable
that will complete after the time duration expires.default Completable
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.Executor
currentTime, execute, schedule, schedule
Methods inherited from interface io.servicetalk.concurrent.api.ListenableAsyncCloseable
onClose, onClosing
-
Method Details
-
timer
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:
-
timer
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:
-
submit
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
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
-
submitCallable
-