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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
