Top Description Methods
org.reactfx

public Interface Suspendable

Additional top-level classes in compilation unit: BiSuspendable, MultiSuspendable.

Known Direct Subinterfaces
org.reactfx.SuspendableEventStream, org.reactfx.Toggle, org.reactfx.collection.SuspendableList, org.reactfx.value.SuspendableVal
Known Direct Implementers
org.reactfx.BiSuspendable, org.reactfx.MultiSuspendable, org.reactfx.SuspendableBase
Imports
java.util.Arrays, java.util.function.Supplier, javafx.beans.value.ObservableValue

Interface for objects that can be temporarily suspended, where the definition of "suspended" depends on the context. For example, when an Observable is Suspendable, it means that its notification delivery can be suspended temporarily. In that case, what notifications are delivered when notifications are resumed depends on the concrete implementation. For example, notifications produced while suspended may be queued, accumulated, or ignored completely.

Method Summary

Modifier and TypeMethod and Description
public static Suspendable
combine(Suspendable... suspendables)

Returns a Suspendable that combines all the given Suspendables into one.

public Guard

Returns:

a Guard instance that can be released to end suspension. In case of suspended notifications, releasing the returned Guard will trigger delivery of queued or accumulated notifications, if any.

The returned Guard is AutoCloseable, which makes it convenient to use in try-with-resources.

suspend
()

Suspends this suspendable object.

public default Subscription

Returns:

A Subscription that can be used to stop observing condition and stop suspending this Suspendable based on condition. If at the time of unsubscribing the returned Subscription this Suspendable was suspended due to condition being true, it will be resumed.
suspendWhen
(ObservableValue<Boolean> condition)

Arranges to suspend this Suspendable whenever condition is true.

public default void
suspendWhile(Runnable r)

Runs the given computation while suspended.

public default <U> U

Returns:

the result produced by the given supplier f.
suspendWhile
(Supplier<U> f)

Runs the given computation while suspended.

Method Detail

combineback to summary
public static Suspendable combine(Suspendable... suspendables)

Returns a Suspendable that combines all the given Suspendables into one. When that combined Suspendable is suspended, all participating Suspendables are suspended, in the given order. When resumed, all participating Suspendables are resumed, in reverse order.

suspendback to summary
public Guard suspend()

Suspends this suspendable object.

In case of suspendable Observable, suspends notification delivery for this observable object. Notifications produced while suspended may be queued for later delivery, accumulated into a single cumulative notification, or discarded completely, depending on the concrete implementation.

Returns:Guard

a Guard instance that can be released to end suspension. In case of suspended notifications, releasing the returned Guard will trigger delivery of queued or accumulated notifications, if any.

The returned Guard is AutoCloseable, which makes it convenient to use in try-with-resources.

suspendWhenback to summary
public default Subscription suspendWhen(ObservableValue<Boolean> condition)

Arranges to suspend this Suspendable whenever condition is true.

Returns:Subscription

A Subscription that can be used to stop observing condition and stop suspending this Suspendable based on condition. If at the time of unsubscribing the returned Subscription this Suspendable was suspended due to condition being true, it will be resumed.

suspendWhileback to summary
public default void suspendWhile(Runnable r)

Runs the given computation while suspended.

Equivalent to

try(Guard g = suspend()) {
    r.run();
}
suspendWhileback to summary
public default <U> U suspendWhile(Supplier<U> f)

Runs the given computation while suspended. The code

T t = this.suspendWhile(f);
is equivalent to
T t;
try(Guard g = suspend()) {
    t = f.get();
}
Returns:U

the result produced by the given supplier f.