You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by Oliver Zeigermann <ol...@gmail.com> on 2004/12/17 13:34:45 UTC

[transation][all] Tiny concurrency testing class

Folks,

I know this is nothing new, but I have just created a tiny class that
helps you make concurrent scenarios deterministic. This is very useful
for testing where you want to have a contious flow throughout
different threads. The idea is to have an ordered sequence of numbers
where n can not be executed before n-1 has not been:

Here are the API docs

http://jakarta.apache.org/commons/transaction/apidocs/org/apache/commons/transaction/util/CounterBarrier.html

and here are the sources

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

As an example have a look at the testPreference() method in

http://cvs.apache.org/viewcvs.cgi/jakarta-commons/transaction/src/test/org/apache/commons/transaction/locking/GenericLockTest.java?rev=1.4&view=markup

Getting the same sutff done with synchronized blocks is something that
will make you need medical attendance very soon.

Hope I am not already getting on anybodies nervers with me stuff and cheers,

Oliver

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org