[concurrency-interest] Is there something like an ordered or counting barrier

Oliver Zeigermann ozeigermann@apache.org
Wed, 29 Dec 2004 01:09:05 +0100


Folks,

I was struggeling to make some multi threaded test scenarios
deterministic and was looking for something that lets me determine the
sequence of steps distributed over the threads. My idea was not to let
step n be executed before step n-1.

I know CountDownLatch and CyclicBarrier, but they both do not seem to
help me in that scenario.

Because of that I made up a tiny class that does this for me

http://cvs.apache.org/viewcvs.cgi/jakarta-commons/transaction/src/java/org/apache/commons/transaction/util/SequenceBarrier.java?view=markup

and wanted to know if there are more elegant ways to do so and if this
makes sense in the first place.

Thanks for any hints and comments,

Oliver