Class WorkStealingFuture<T>
java.lang.Object
com.github.basking2.sdsai.itrex.util.WorkStealingFuture<T>
- Type Parameters:
T
- The type returned.
- All Implemented Interfaces:
Future<T>
A future that will, on calls to
get()
, let the calling thread do the work.-
Method Summary
Modifier and TypeMethodDescriptionboolean
cancel
(boolean b) Call cancel on the underlying future.static <T> WorkStealingFuture<T>
get()
boolean
The result of calling isCancelled on the underlying future.boolean
isDone()
Is this computation done and is there a result that may be fetched.static <T> WorkStealingFuture<T>
run
(ExecutorService executorService, Callable<T> callable)
-
Method Details
-
run
-
execute
-
cancel
public boolean cancel(boolean b) Call cancel on the underlying future. -
isCancelled
public boolean isCancelled()The result of calling isCancelled on the underlying future.- Specified by:
isCancelled
in interfaceFuture<T>
- Returns:
- The result of calling isCancelled on the underlying future.
-
isDone
public boolean isDone()Is this computation done and is there a result that may be fetched. -
get
- Specified by:
get
in interfaceFuture<T>
- Throws:
InterruptedException
ExecutionException
-
get
public T get(long l, TimeUnit timeUnit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
get
in interfaceFuture<T>
- Throws:
InterruptedException
ExecutionException
TimeoutException
-