public class RecomputingSupplier<T>
extends java.lang.Object
get(long, TimeUnit)
to wait until this value is computed if
it was not computed yet.
Calling recompute()
won't reset value for the already
waiting consumers, but instead will schedule one recomputation as soon as current one is done.Constructor and Description |
---|
RecomputingSupplier(java.util.function.Supplier<T> supplier,
java.util.concurrent.ExecutorService executor) |
Modifier and Type | Method and Description |
---|---|
T |
get(long timeout,
java.util.concurrent.TimeUnit timeUnit) |
void |
recompute() |
java.lang.String |
toString() |
public RecomputingSupplier(java.util.function.Supplier<T> supplier, java.util.concurrent.ExecutorService executor)
public void recompute()
public T get(long timeout, java.util.concurrent.TimeUnit timeUnit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2009- The Apache Software Foundation