public class VirtualTimeFuture<T>
extends java.lang.Object
implements java.util.concurrent.ScheduledFuture<T>
VirtualTimeScheduler
to track the actions scheduled on it.
Allows for introspection of the scheduled action through various helper methods.Modifier and Type | Method and Description |
---|---|
boolean |
cancel(boolean mayInterruptIfRunning) |
int |
compareTo(java.util.concurrent.Delayed o) |
T |
get() |
T |
get(long timeout,
java.util.concurrent.TimeUnit unit) |
java.util.concurrent.Callable<T> |
getCallable()
Gets the Callable this future is created for.
|
long |
getDelay(java.util.concurrent.TimeUnit unit) |
long |
getId()
Helper used by the scheduler's Comparator to distinguish/order futures scheduled for the same time.
|
long |
getOffset()
Gets the Offset between invocations of the action behind this future, for repeated actions only.
|
VirtualTimeScheduler |
getOwningScheduler()
Gets the VirtualTimeScheduler this future is associated with.
|
VirtualTimeRepeatKind |
getRepeatKind()
Describes if this future is repeated and if so how.
|
java.lang.Runnable |
getRunnable()
Gets the Runnable this future is created for.
|
long |
getTick()
Gets the virtual time in nano seconds that this future is scheduled to execute at.
|
boolean |
isCancelled() |
boolean |
isDone() |
public long getDelay(java.util.concurrent.TimeUnit unit)
getDelay
in interface java.util.concurrent.Delayed
public int compareTo(java.util.concurrent.Delayed o)
compareTo
in interface java.lang.Comparable<java.util.concurrent.Delayed>
public boolean cancel(boolean mayInterruptIfRunning)
cancel
in interface java.util.concurrent.Future<T>
public boolean isCancelled()
isCancelled
in interface java.util.concurrent.Future<T>
public boolean isDone()
isDone
in interface java.util.concurrent.Future<T>
public T get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
get
in interface java.util.concurrent.Future<T>
java.lang.InterruptedException
java.util.concurrent.ExecutionException
public T get(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
get
in interface java.util.concurrent.Future<T>
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException
public long getTick()
public java.lang.Runnable getRunnable()
public java.util.concurrent.Callable<T> getCallable()
public VirtualTimeScheduler getOwningScheduler()
public long getOffset()
public VirtualTimeRepeatKind getRepeatKind()
public long getId()