org.apache.avalon.excalibur.concurrent
Class ThreadBarrier

java.lang.Object
  |
  +--org.apache.avalon.excalibur.concurrent.ThreadBarrier

public class ThreadBarrier
extends java.lang.Object

A thread barrier blocks all threads hitting it until a pre-defined number of threads arrive at the barrier. This is useful for implementing release consistent concurrency where you don't want to take the performance penalty of providing mutual exclusion to shared resources

Since:
4.0
Version:
CVS $Revision: 1.3 $ $Date: 2001/12/11 09:53:28 $
Author:
Karthik Rangaraju

Constructor Summary
ThreadBarrier(int count)
          Initializes a thread barrier object with a given thread count
 
Method Summary
 void barrierSynchronize()
          This method blocks all threads calling it until the threshold number of threads have called it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadBarrier

public ThreadBarrier(int count)
Initializes a thread barrier object with a given thread count
Parameters:
pCount - is the number of threads that need to block on barrierSynchronize() before they will be allowed to pass through
See Also:
barrierSynchronize()
Method Detail

barrierSynchronize

public void barrierSynchronize()
                        throws java.lang.InterruptedException
This method blocks all threads calling it until the threshold number of threads have called it. It then releases all threads blocked by it
Throws:
java.lang.InterruptedException - if any thread blocked during the call is interrupted


Copyright © 2001 Apache Jakarta Project. All Rights Reserved.