Package ghidra.async
Class AsyncTimer.Mark
java.lang.Object
ghidra.async.AsyncTimer.Mark
- Enclosing class:
AsyncTimer
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionafter
(long intervalMillis) Schedule a task to run when the given number of milliseconds has passed since this mark<T> CompletableFuture
<T> timeOut
(CompletableFuture<T> future, long millis, Supplier<T> valueIfLate) Time a future out after the given interval
-
Field Details
-
mark
protected final long mark
-
-
Constructor Details
-
Mark
protected Mark(long mark)
-
-
Method Details
-
after
Schedule a task to run when the given number of milliseconds has passed since this markThe method returns immediately, giving a future result. The future completes "soon after" the requested interval since the last mark passes. There is some minimal overhead, but the scheduler endeavors to complete the future as close to the given time as possible. The actual scheduled time will not precede the requested time.
- Parameters:
intervalMillis
- the interval after which the returned future completes- Returns:
- a future that completes soon after the given interval
-
timeOut
public <T> CompletableFuture<T> timeOut(CompletableFuture<T> future, long millis, Supplier<T> valueIfLate) Time a future out after the given interval- Type Parameters:
T
- the type of the future- Parameters:
future
- the future whose value is expected in the given intervalmillis
- the time interval in millisecondsvalueIfLate
- a supplier for the value if the future doesn't complete in time- Returns:
- a future which completes with the given futures value, or the late value if it times out.
-