Package org.ldk.structs
Class Sleeper
- java.lang.Object
-
- org.ldk.structs.Sleeper
-
public class Sleeper extends Object
A struct which can be used to select across many [`Future`]s at once without relying on a full async context.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
finalize()
static Sleeper
from_single_future(Future future)
Constructs a new sleeper from one future, allowing blocking on it.static Sleeper
from_two_futures(Future fut_a, Future fut_b)
Constructs a new sleeper from two futures, allowing blocking on both at once.static Sleeper
of(Future[] futures)
Constructs a new sleeper on many futures, allowing blocking on all at once.void
wait_indefinite()
Wait until one of the [`Future`]s registered with this [`Sleeper`] has completed.boolean
wait_timeout(long max_wait)
Wait until one of the [`Future`]s registered with this [`Sleeper`] has completed or the given amount of time has elapsed.
-
-
-
Method Detail
-
finalize
protected void finalize() throws Throwable
-
from_single_future
public static Sleeper from_single_future(Future future)
Constructs a new sleeper from one future, allowing blocking on it.
-
from_two_futures
public static Sleeper from_two_futures(Future fut_a, Future fut_b)
Constructs a new sleeper from two futures, allowing blocking on both at once.
-
of
public static Sleeper of(Future[] futures)
Constructs a new sleeper on many futures, allowing blocking on all at once.
-
wait_indefinite
public void wait_indefinite()
Wait until one of the [`Future`]s registered with this [`Sleeper`] has completed.
-
wait_timeout
public boolean wait_timeout(long max_wait)
Wait until one of the [`Future`]s registered with this [`Sleeper`] has completed or the given amount of time has elapsed. Returns true if a [`Future`] completed, false if the time elapsed.
-
-