public class GuardedExecutor extends Object implements Executor, RxSubscriber
Executor
and RxSubscriber
which promises to cancel its subscriptions and stop executing tasks
once its getGuard()
has been disposed.
Useful for tying asynchronous tasks to gui elements.Constructor and Description |
---|
GuardedExecutor(RxExecutor delegate,
Chit guard) |
Modifier and Type | Method and Description |
---|---|
void |
execute(Runnable command) |
RxExecutor |
getDelegateRxExecutor()
The underlying executor which is being delegated to.
|
Chit |
getGuard()
The element on which all executions and subscriptions are guarded.
|
<T> void |
subscribe(CompletionStage<? extends T> future,
RxListener<T> listener)
Subscribes the given listener to the given Java 8 CompletableFuture.
|
<T> void |
subscribe(ListenableFuture<? extends T> future,
RxListener<T> listener)
Subscribes the given listener to the given Guava ListenableFuture.
|
<T> void |
subscribe(Observable<? extends T> observable,
RxListener<T> listener)
Subscribes the given listener to the given observable.
|
<T> Disposable |
subscribeDisposable(CompletionStage<? extends T> future,
RxListener<T> listener)
Subscribes the given listener to the given Java 8 CompletableFuture.
|
<T> Disposable |
subscribeDisposable(ListenableFuture<? extends T> future,
RxListener<T> listener)
Subscribes the given listener to the given Guava ListenableFuture.
|
<T> Disposable |
subscribeDisposable(Observable<? extends T> observable,
RxListener<T> listener)
Subscribes the given listener to the given observable.
|
Runnable |
wrap(Runnable delegate)
Creates a runnable which runs on this Executor iff the guard widget is not disposed.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
subscribe, subscribe, subscribe, subscribe, subscribe, subscribeDisposable, subscribeDisposable, subscribeDisposable, subscribeDisposable, subscribeDisposable
public GuardedExecutor(RxExecutor delegate, Chit guard)
public final RxExecutor getDelegateRxExecutor()
public final Chit getGuard()
public final Runnable wrap(Runnable delegate)
public final <T> Disposable subscribeDisposable(Observable<? extends T> observable, RxListener<T> listener)
RxSubscriber
subscribeDisposable
in interface RxSubscriber
public final <T> Disposable subscribeDisposable(ListenableFuture<? extends T> future, RxListener<T> listener)
RxSubscriber
subscribeDisposable
in interface RxSubscriber
public final <T> Disposable subscribeDisposable(CompletionStage<? extends T> future, RxListener<T> listener)
RxSubscriber
subscribeDisposable
in interface RxSubscriber
public final <T> void subscribe(Observable<? extends T> observable, RxListener<T> listener)
RxSubscriber
subscribe
in interface RxSubscriber
public final <T> void subscribe(ListenableFuture<? extends T> future, RxListener<T> listener)
RxSubscriber
subscribe
in interface RxSubscriber
public final <T> void subscribe(CompletionStage<? extends T> future, RxListener<T> listener)
RxSubscriber
subscribe
in interface RxSubscriber