Search code examples
javajava.util.concurrentbarrier

barrier with dynamic number of parties in java


I want a barrier with a dynamic number of parties in java. I came across Phaser, but this solution is for java 7 which I unfortunately cannot use.

Is there some solution for java 6. How should I satisfy the need for having a barrier with a variable number of waiters ?


Solution

  • You really want to use a Phaser. There is a backport for Phaser that you can use in Java 6. Download it from JSR 166y backport