com.hammurapi.util.concurrent
Class CountedRunnable

java.lang.Object
  extended by com.hammurapi.util.concurrent.CountedRunnable
All Implemented Interfaces:
Runnable

public class CountedRunnable
extends Object
implements Runnable

This class increments counter when created and decrements when run() method exits. When counter reaches zero, this class invokes notifyAll() on the counter. The class shall be used for parallel execution of tasks when it is required to wait until all tasks complete.

Author:
Pavel Vlasov

Nested Class Summary
static class CountedRunnable.Counter
          Counter to use with CounterRunnable.
 
Constructor Summary
CountedRunnable(CountedRunnable.Counter counter, Runnable master)
           
 
Method Summary
 void run()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CountedRunnable

public CountedRunnable(CountedRunnable.Counter counter,
                       Runnable master)
Method Detail

run

public final void run()
Specified by:
run in interface Runnable