|
|||||||||
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 java.util.concurrent.CountDownLatch |
createLatch()
Factory method that should return CountDownLatch or its descendant initialized to 1. |
RESULT |
get()
Blocks until the future is computed and then returns the result of the computation. |
RESULT |
get(long timeout,
java.util.concurrent.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 java.util.concurrent.CountDownLatch createLatch()
FutureWithListeners
CountDownLatch
or its descendant initialized to 1.
createLatch
in class 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 java.util.concurrent.Future<RESULT>
get
in class FutureWithListeners<RESULT>
ComponentFutureException
public RESULT get(long timeout, java.util.concurrent.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 java.util.concurrent.Future<RESULT>
get
in class FutureWithListeners<RESULT>
timeout
- unit
-
ComponentFutureException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |