[concurrency-interest] How has java.util.concurrent.locks been tested?

Doug Lea dl@cs.oswego.edu
Wed, 29 Dec 2004 19:19:43 -0500

> E.g. in testhasQueuedThreads I have found
> Thread.sleep(SHORT_DELAY_MS);
> which - I suppose - does what I was trying to do with my sequence
> barrier. 

Since ReentrantLockTest etc are tests of basic blocking/locking
facilities, we can't use locks themselves to block threads, so must
use the rule that implementations pass if there exists some value for
SHORT_DELAY_MS that succeeds. It is not a bad convention in some other
kinds of tests as well, since it avoids needing intricate synch to set
up tests.

> Especially when  you debug your code this is likely to fail,
> isn't it?

Yes, but these TCK tests aren't especially good for debugging anyway.