cz.cuni.amis.pogamut.base.component.bus.event
Class BusAwareCountDownLatch

Package class diagram package BusAwareCountDownLatch
java.lang.Object
  extended by java.util.concurrent.CountDownLatch
      extended by cz.cuni.amis.pogamut.base.component.bus.event.BusAwareCountDownLatch

public class BusAwareCountDownLatch
extends CountDownLatch

Extends CoundDownLatch with ability to stop waiting when some component connected to the bus fails which may indicate termination of all other components on the bus. Thus further waiting doesn't make sense.

Author:
ik

Nested Class Summary
static class BusAwareCountDownLatch.BusStoppedInterruptedException
           
 
Constructor Summary
BusAwareCountDownLatch(int count, IComponentBus bus)
           
BusAwareCountDownLatch(int count, IComponentBus bus, IComponent... components)
           
BusAwareCountDownLatch(int count, IComponentBus bus, cz.cuni.amis.utils.token.IToken... componentIds)
           
 
Method Summary
 void await()
           
 boolean await(long timeout, TimeUnit unit)
           
protected  void checkBusStop()
           
 void countDown()
           
 String toString()
           
 
Methods inherited from class java.util.concurrent.CountDownLatch
getCount
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BusAwareCountDownLatch

public BusAwareCountDownLatch(int count,
                              IComponentBus bus)

BusAwareCountDownLatch

public BusAwareCountDownLatch(int count,
                              IComponentBus bus,
                              IComponent... components)

BusAwareCountDownLatch

public BusAwareCountDownLatch(int count,
                              IComponentBus bus,
                              cz.cuni.amis.utils.token.IToken... componentIds)
Method Detail

countDown

public void countDown()
Overrides:
countDown in class CountDownLatch

await

public void await()
           throws BusAwareCountDownLatch.BusStoppedInterruptedException,
                  cz.cuni.amis.utils.exception.PogamutInterruptedException
Overrides:
await in class CountDownLatch
Throws:
BusAwareCountDownLatch.BusStoppedInterruptedException - when the waiting was stopped because some component of the bus stopped
cz.cuni.amis.utils.exception.PogamutInterruptedException

await

public boolean await(long timeout,
                     TimeUnit unit)
              throws BusAwareCountDownLatch.BusStoppedInterruptedException,
                     cz.cuni.amis.utils.exception.PogamutInterruptedException
Overrides:
await in class CountDownLatch
Parameters:
timeout -
unit -
Returns:
Throws:
BusAwareCountDownLatch.BusStoppedInterruptedException - when the waiting was stopped because some component of the bus stopped
cz.cuni.amis.utils.exception.PogamutInterruptedException

checkBusStop

protected void checkBusStop()
                     throws BusAwareCountDownLatch.BusStoppedInterruptedException
Throws:
BusAwareCountDownLatch.BusStoppedInterruptedException

toString

public String toString()
Overrides:
toString in class CountDownLatch


Copyright © 2014 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.