massim.framework.util
Class FutureObject<T>
java.lang.Object
massim.framework.util.FutureObject<T>
- Type Parameters:
T
- class of object to wrap.
- All Implemented Interfaces:
- java.util.concurrent.Future
public class FutureObject<T>
- extends java.lang.Object
- implements java.util.concurrent.Future
This class just wraps some object that will be created or finished later in a Future. It's not cancallable by default.
Constructor Summary |
FutureObject()
Constructs a new FutureObject, which is not "done" by default. |
Method Summary |
boolean |
cancel(boolean arg0)
won't work. |
void |
deliver(T obj)
Deliver object to this FutureObject object. |
T |
get()
|
T |
get(long timeout,
java.util.concurrent.TimeUnit unit)
|
boolean |
isCancelled()
This implementation of Future is never cancelled. |
boolean |
isDone()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FutureObject
public FutureObject()
- Constructs a new FutureObject, which is not "done" by default.
cancel
public boolean cancel(boolean arg0)
- won't work.
- Specified by:
cancel
in interface java.util.concurrent.Future
isCancelled
public boolean isCancelled()
- This implementation of Future is never cancelled.
- Specified by:
isCancelled
in interface java.util.concurrent.Future
isDone
public boolean isDone()
- Specified by:
isDone
in interface java.util.concurrent.Future
get
public T get()
throws java.lang.InterruptedException,
java.util.concurrent.ExecutionException
- Specified by:
get
in interface java.util.concurrent.Future
- Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
get
public T get(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException,
java.util.concurrent.ExecutionException,
java.util.concurrent.TimeoutException
- Specified by:
get
in interface java.util.concurrent.Future
- Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException
deliver
public void deliver(T obj)
- Deliver object to this FutureObject object. Call this method to assign the object to this Future and
set it to "done".
- Parameters:
obj
-
Copyright © 2012. All Rights Reserved.