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
-
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()
.
-
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:
isCancelled
in interfaceFuture<V>
-
isDone
public boolean 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
-