|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cz.cuni.amis.utils.future.FutureWithListeners<RESULT> cz.cuni.amis.pogamut.base.utils.future.ComponentFuture<RESULT>
RESULT
- public class ComponentFuture<RESULT>
Future that depends on the running state of the IComponent
. This future guarantees
that it unblock all threads waiting for the result if the world view (or other component(s) specified
via ComponentFuture(IComponentBus, IComponent...)
) dies.
Field Summary |
---|
Fields inherited from class cz.cuni.amis.utils.future.FutureWithListeners |
---|
latch, listeners, mutex |
Constructor Summary | |
---|---|
ComponentFuture(IComponentBus bus,
IComponent... dependants)
Constructor where you have to specify components on which the result depends + its component bus. |
Method Summary | |
---|---|
protected CountDownLatch |
createLatch()
|
RESULT |
get()
Blocks until the future is computed and then returns the result of the computation. |
RESULT |
get(long timeout,
TimeUnit unit)
Blocks until the future is computed (or timeout) and then returns the result of the computation. |
Methods inherited from class cz.cuni.amis.utils.future.FutureWithListeners |
---|
addFutureListener, cancel, cancelComputation, computationException, getException, getStatus, isCancelled, isDone, isListening, removeFutureListener, setResult, switchStatus |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ComponentFuture(IComponentBus bus, IComponent... dependants)
bus
- may be null - in this case a simple CountDownLatch
is created instead of BusAwareCountDownLatch
dependants
- may be null or zero-length - in this case a simple CountDownLatch
is created instead of BusAwareCountDownLatch
Method Detail |
---|
protected CountDownLatch createLatch()
createLatch
in class cz.cuni.amis.utils.future.FutureWithListeners<RESULT>
public RESULT get() throws ComponentFutureException
If the result can't be computed (computation is cancelled, exception happens or some component working on the future
result stops), throws an ComponentFutureException
.
For additional info, see FutureWithListeners.get()
.
get
in interface cz.cuni.amis.utils.future.IFutureWithListeners<RESULT>
get
in interface Future<RESULT>
get
in class cz.cuni.amis.utils.future.FutureWithListeners<RESULT>
ComponentFutureException
public RESULT get(long timeout, TimeUnit unit) throws ComponentFutureException
If the result can't be computed (computation is cancelled, exception happens or some component working on the future
result stops), throws an ComponentFutureException
.
For additional info, see FutureWithListeners.get(long, TimeUnit)
.
get
in interface cz.cuni.amis.utils.future.IFutureWithListeners<RESULT>
get
in interface Future<RESULT>
get
in class cz.cuni.amis.utils.future.FutureWithListeners<RESULT>
timeout
- unit
-
ComponentFutureException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |