Suspendable
.@Deprecated public interface Observable extends Observable, Guardian
Modifier and Type | Method and Description |
---|---|
Guard |
block()
Deprecated.
Prevents invalidation and change events from being emitted,
until the returned guard is released.
|
default void |
blockWhile(Runnable r)
Deprecated.
Runs the given computation, making sure the invalidation and change
events are blocked.
|
default <T> T |
blockWhile(Supplier<T> f)
Deprecated.
Runs the given computation, making sure the invalidation and change
events are blocked.
|
default Guard |
guard()
Deprecated.
Equivalent to
block() . |
addListener, removeListener
combine, guardWhile, guardWhile
Guard block()
Guard
instance that can be released to resume
the delivery of invalidation and change events. If this observable
has been invalidated one or more times before the guard is released,
a single notification is passed to invalidation and change listeners
of this observable.
The returned Guard
is AutoCloseable
, which makes it
convenient to use in try-with-resources.default void blockWhile(Runnable r)
Equivalent to
try(Guard g = block()) { r.run(); }
default <T> T blockWhile(Supplier<T> f)
T t = this.blockWhile(f);is equivalent to
T t; try(Guard g = block()) { t = f.get(); }