org.kth.dks.util
Class Future
java.lang.Object
org.kth.dks.util.Future
- Direct Known Subclasses:
- ReusableFuture
public class Future
- extends java.lang.Object
Future implements a facility to wait for the result of an
asynchronous computation. It is meant to be an implementation of the
java.util.concurrent.Future interface, although to be compilable with JSE 1.4,
generics are not used. If you have 5.0, probably use java.util.concurrent.FutureTask instead.
The future class decouples the underlying computations from the return mechanism.
That is, the cancel method will never actually cancel any computation that computes
the value of the future.
The class supports multiple waiters.
|
Method Summary |
void |
cancel(boolean mayInterruptIfRunning)
|
void |
cancel(java.lang.Exception ex)
|
java.lang.Object |
get()
|
java.lang.Object |
get(long timeout)
|
boolean |
isCancelled()
|
boolean |
isDone()
|
void |
store(java.lang.Object value)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Future
public Future()
Future
public Future(java.lang.Object value)
get
public java.lang.Object get()
throws java.lang.InterruptedException,
CancellationException,
java.lang.Exception
- Throws:
java.lang.InterruptedException
CancellationException
java.lang.Exception
get
public java.lang.Object get(long timeout)
throws TimeoutException,
java.lang.InterruptedException,
CancellationException
- Throws:
TimeoutException
java.lang.InterruptedException
CancellationException
isDone
public boolean isDone()
isCancelled
public boolean isCancelled()
store
public void store(java.lang.Object value)
cancel
public void cancel(boolean mayInterruptIfRunning)
cancel
public void cancel(java.lang.Exception ex)
Copyright © 2010. All Rights Reserved.