public final class Disposables
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static Disposable |
disposed()
Returns a disposed Disposable instance.
|
static Disposable |
empty()
Returns a new, non-disposed Disposable instance.
|
static Disposable |
fromAction(Action run)
Construct a Disposable by wrapping a Action that is
executed exactly once when the Disposable is disposed.
|
static Disposable |
fromFuture(java.util.concurrent.Future<?> future)
Construct a Disposable by wrapping a Future that is
cancelled exactly once when the Disposable is disposed.
|
static Disposable |
fromFuture(java.util.concurrent.Future<?> future,
boolean allowInterrupt)
Construct a Disposable by wrapping a Future that is
cancelled exactly once when the Disposable is disposed.
|
static Disposable |
fromRunnable(java.lang.Runnable run)
Construct a Disposable by wrapping a Runnable that is
executed exactly once when the Disposable is disposed.
|
static Disposable |
fromSubscription(org.reactivestreams.Subscription subscription)
Construct a Disposable by wrapping a Subscription that is
cancelled exactly once when the Disposable is disposed.
|
public static Disposable fromRunnable(java.lang.Runnable run)
run
- the Runnable to wrappublic static Disposable fromAction(Action run)
run
- the Action to wrappublic static Disposable fromFuture(java.util.concurrent.Future<?> future)
future
- the Future to wrappublic static Disposable fromFuture(java.util.concurrent.Future<?> future, boolean allowInterrupt)
future
- the Future to wrapallowInterrupt
- if true, the future cancel happens via Future.cancel(true)public static Disposable fromSubscription(org.reactivestreams.Subscription subscription)
subscription
- the Runnable to wrappublic static Disposable empty()
public static Disposable disposed()