public abstract class DelegatingExecutor extends Object implements Executor
| Constructor and Description |
|---|
DelegatingExecutor(Executor delegate)
New instance.
|
| Modifier and Type | Method and Description |
|---|---|
Completable |
closeAsync()
Used to close/shutdown a resource.
|
Completable |
closeAsyncGracefully()
Used to close/shutdown a resource, similar to
AsyncCloseable.closeAsync(), but attempts to cleanup state before
abruptly closing. |
Cancellable |
execute(Runnable task) |
Completable |
onClose()
Returns a
Completable that is notified once the ListenableAsyncCloseable was closed. |
Cancellable |
schedule(Runnable task,
Duration delay) |
Cancellable |
schedule(Runnable task,
long delay,
TimeUnit unit) |
<T> Single<T> |
submit(Callable<? extends T> callable)
Creates a new
Single that creates and executes the passed Callable when subscribed to. |
Completable |
submit(Runnable runnable)
Create a new
Completable that executes the passed Runnable on each subscribe. |
<T> Single<T> |
submitCallable(Supplier<? extends Callable<? extends T>> callableSupplier)
|
Completable |
submitRunnable(Supplier<Runnable> runnableSupplier)
Creates a new
Completable that creates and executes a Runnable when subscribed to. |
Completable |
timer(Duration delay)
Creates a new
Completable that will complete after the time duration expires. |
Completable |
timer(long delay,
TimeUnit unit)
Creates a new
Completable that will complete after the time duration expires. |
public Cancellable execute(Runnable task)
throws RejectedExecutionException
execute in interface ExecutorRejectedExecutionExceptionpublic Cancellable schedule(Runnable task,
long delay,
TimeUnit unit)
throws RejectedExecutionException
schedule in interface ExecutorRejectedExecutionExceptionpublic Cancellable schedule(Runnable task,
Duration delay)
throws RejectedExecutionException
schedule in interface ExecutorRejectedExecutionExceptionpublic Completable timer(long delay, TimeUnit unit)
ExecutorCompletable that will complete after the time duration expires.delay - The time duration which is allowed to elapse between subscribe and termination.unit - The units for duration.Completable that will complete after the time duration expires.public Completable timer(Duration delay)
ExecutorCompletable that will complete after the time duration expires.delay - The time duration which is allowed to elapse between subscribe and termination.Completable that will complete after the time duration expires.public Completable submit(Runnable runnable)
ExecutorCompletable that executes the passed Runnable on each subscribe.runnable - The Runnable to execute on each subscribe.Completable that executes a Runnable on each subscribe.public Completable submitRunnable(Supplier<Runnable> runnableSupplier)
ExecutorCompletable that creates and executes a Runnable when subscribed to.runnableSupplier - Supplier to create a new Runnable for every subscribe of the returned
Completable.Completable that creates and executes a new Runnable using
runnableSupplier for every subscribe.public <T> Single<T> submit(Callable<? extends T> callable)
ExecutorSingle that creates and executes the passed Callable when subscribed to.public <T> Single<T> submitCallable(Supplier<? extends Callable<? extends T>> callableSupplier)
Executorpublic Completable onClose()
ListenableAsyncCloseableCompletable that is notified once the ListenableAsyncCloseable was closed.onClose in interface ListenableAsyncCloseableCompletable that is notified on close.public Completable closeAsync()
AsyncCloseablecloseAsync in interface AsyncCloseableCompletableSource that is notified once the close is complete.public Completable closeAsyncGracefully()
AsyncCloseableAsyncCloseable.closeAsync(), but attempts to cleanup state before
abruptly closing. This provides a hint that implementations can use to stop accepting new work and finish in
flight work. This method is implemented on a "best effort" basis and may be equivalent to AsyncCloseable.closeAsync().
Note: Implementations may or may not apply a timeout for this operation to complete, if a caller does not
want to wait indefinitely, and are unsure if the implementation applies a timeout, it is advisable to apply a
timeout and force a call to AsyncCloseable.closeAsync().
closeAsyncGracefully in interface AsyncCloseableCompletable that is notified once the close is complete.