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
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.concurrent.Future
Future.State -
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().Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.concurrent.Future
exceptionNow, resultNow, state
-
Field Details
-
result
-
exception
-
cancelled
protected volatile boolean cancelled -
done
-
-
Constructor Details
-
SimpleFuture
public SimpleFuture()
-
-
Method Details
-
cancel
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfaceFuture<V>
-
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
-