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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
cancel
(boolean mayInterruptIfRunning) get()
boolean
boolean
isDone()
void
Sets the result to be returned byFuture.get()
.void
Sets the exception to be wrapped in anExecutionException
and thrown byFuture.get()
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
isCancelled
in interfaceFuture<V>
-
isDone
-
setException
Sets the exception to be wrapped in anExecutionException
and thrown byFuture.get()
. May be called only from the thread executing the computation.- Specified by:
setException
in 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:
set
in interfaceSettableFuture<V>
- Parameters:
r
- the result
-
get
- Specified by:
get
in interfaceFuture<V>
- Throws:
CancellationException
ExecutionException
InterruptedException
-
get
public V get(long timeout, TimeUnit unit) throws CancellationException, ExecutionException, InterruptedException, TimeoutException - Specified by:
get
in interfaceFuture<V>
- Throws:
CancellationException
ExecutionException
InterruptedException
TimeoutException
-