readwritelocktest.java
来自「JGRoups源码」· Java 代码 · 共 43 行
JAVA
43 行
package org.jgroups.tests;
import EDU.oswego.cs.dl.util.concurrent.ReadWriteLock;
import EDU.oswego.cs.dl.util.concurrent.ReentrantWriterPreferenceReadWriteLock;
import EDU.oswego.cs.dl.util.concurrent.Sync;
import junit.framework.TestCase;
/**
* @author bela
* @version $Id: ReadWriteLockTest.java,v 1.1 2006/05/12 09:50:25 belaban Exp $
*/
public class ReadWriteLockTest extends TestCase {
Sync rl, wl;
protected void setUp() throws Exception {
super.setUp();
ReadWriteLock l=new ReentrantWriterPreferenceReadWriteLock();
rl=l.readLock();
wl=l.writeLock();
}
protected void tearDown() throws Exception {
super.tearDown();
}
public void testRelease() throws InterruptedException {
rl.acquire();
rl.release();
}
public void testUpgrade() throws InterruptedException {
rl.acquire();
rl.acquire();
wl.acquire();
wl.acquire();
rl.acquire();
rl.release();
wl.acquire();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?