public class SyncFuture<T> extends Object implements Future<T>, Serializable
This Future
wraps a result computed synchronously and consequently return it as soon as get()
is
called.
Constructor and Description |
---|
SyncFuture(T val)
Builds a new instance.
|
public SyncFuture(T val)
Builds a new instance.
val
- the wrapped valuepublic boolean cancel(boolean mayInterruptIfRunning)
public boolean isCancelled()
isCancelled
in interface Future<T>
public T get() throws InterruptedException, ExecutionException
get
in interface Future<T>
InterruptedException
ExecutionException
public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get
in interface Future<T>
InterruptedException
ExecutionException
TimeoutException
Copyright © 2012-2015. All Rights Reserved.