Package VASSAL.tools.concurrent
Class SimpleFuture<V>
java.lang.Object
VASSAL.tools.concurrent.SimpleFuture<V>
- Type Parameters:
V- the result type returned by theget()method
- All Implemented Interfaces:
Future<V>,SettableFuture<V>
- Direct Known Subclasses:
SimpleRunnableFuture
An uninterruptable
SettableFuture.- Since:
- 3.1.11
- Author:
- Joel Uckelman
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancancel(boolean mayInterruptIfRunning)get()booleanbooleanisDone()voidSets the result to be returned byFuture.get().voidSets the exception to be wrapped in anExecutionExceptionand thrown byFuture.get().
-
Field Details
-
result
-
exception
-
cancelled
protected volatile boolean cancelled -
done
-
-
Constructor Details
-
SimpleFuture
public SimpleFuture()
-
-
Method Details
-
cancel
public boolean cancel(boolean mayInterruptIfRunning)This implementation is uninterruptable, so ignores the parameter.
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfaceFuture<V>
-
isDone
public boolean isDone() -
setException
Sets the exception to be wrapped in anExecutionExceptionand thrown byFuture.get(). May be called only from the thread executing the computation.- Specified by:
setExceptionin interfaceSettableFuture<V>- Parameters:
t- the exception
-
set
Sets the result to be returned byFuture.get(). May be called only from the thread executing the computation.- Specified by:
setin interfaceSettableFuture<V>- Parameters:
r- the result
-
get
- Specified by:
getin interfaceFuture<V>- Throws:
CancellationExceptionExecutionExceptionInterruptedException
-
get
public V get(long timeout, TimeUnit unit) throws CancellationException, ExecutionException, InterruptedException, TimeoutException- Specified by:
getin interfaceFuture<V>- Throws:
CancellationExceptionExecutionExceptionInterruptedExceptionTimeoutException
-