01: package org.jgroups.tests;
02:
03: import EDU.oswego.cs.dl.util.concurrent.ReadWriteLock;
04: import EDU.oswego.cs.dl.util.concurrent.ReentrantWriterPreferenceReadWriteLock;
05: import EDU.oswego.cs.dl.util.concurrent.Sync;
06: import junit.framework.TestCase;
07:
08: /**
09: * @author bela
10: * @version $Id: ReadWriteLockTest.java,v 1.1 2006/05/12 09:50:25 belaban Exp $
11: */
12: public class ReadWriteLockTest extends TestCase {
13: Sync rl, wl;
14:
15: protected void setUp() throws Exception {
16: super .setUp();
17: ReadWriteLock l = new ReentrantWriterPreferenceReadWriteLock();
18: rl = l.readLock();
19: wl = l.writeLock();
20: }
21:
22: protected void tearDown() throws Exception {
23: super .tearDown();
24: }
25:
26: public void testRelease() throws InterruptedException {
27: rl.acquire();
28: rl.release();
29: }
30:
31: public void testUpgrade() throws InterruptedException {
32: rl.acquire();
33: rl.acquire();
34: wl.acquire();
35: wl.acquire();
36: rl.acquire();
37: rl.release();
38: wl.acquire();
39: }
40:
41: }
|