Package com.sun.identity.common
Class ReaderWriterLock.Test
- java.lang.Object
-
- com.sun.identity.common.ReaderWriterLock.Test
-
- Enclosing class:
- ReaderWriterLock
public static class ReaderWriterLock.Test extends Object
The Test class is a unit test for the other code in the current file. Run the test with: java com.holub.asynch.ReaderWriterLock\$Test (the backslash isn't required with windows boxes), and don't include this class file in your final distribution. The output could vary in trivial ways, depending on system timing. The read/write order should be exactly the same as in the following sample: Starting w/0 w/0 writing Starting r/1 Starting w/1 Starting w/2 Starting r/2 Starting r/3 w/0 done Stopping w/0 r/1 reading r/2 reading r/3 reading r/1 done Stopping r/1 r/2 done r/3 done Stopping r/2 Stopping r/3 w/1 writing w/1 done Stopping w/1 w/2 writing w/2 done Stopping w/2
-
-
Constructor Summary
Constructors Constructor Description Test()
Test by creating several readers and writers.
-
-
-
Constructor Detail
-
Test
public Test()
Test by creating several readers and writers. The initial write operation (w/0) should complete before the first read (r/1) runs. Since readers have priority, r/2 and r/3 should run before w/1; and r/1, r/2 and r3 should all run in parallel. When all three reads complete, w1 and w2 should execute sequentially in that order.
-
-
Method Detail
-
main
public static void main(String[] args)
-
-