|
|
@ -101,7 +101,7 @@ public class SimpleReadWriteLockTest {
|
|
|
|
while (true) {
|
|
|
|
while (true) {
|
|
|
|
if (simpleReadWriteLock.tryWriteLock()) {
|
|
|
|
if (simpleReadWriteLock.tryWriteLock()) {
|
|
|
|
System.out.println(Thread.currentThread() + " -1 get write lock success");
|
|
|
|
System.out.println(Thread.currentThread() + " -1 get write lock success");
|
|
|
|
TimeUnit.SECONDS.sleep(5);
|
|
|
|
TimeUnit.SECONDS.sleep(1);
|
|
|
|
System.out.println(Thread.currentThread() + " -1 execute done");
|
|
|
|
System.out.println(Thread.currentThread() + " -1 execute done");
|
|
|
|
simpleReadWriteLock.releaseWriteLock();
|
|
|
|
simpleReadWriteLock.releaseWriteLock();
|
|
|
|
countDownLatch.countDown();
|
|
|
|
countDownLatch.countDown();
|
|
|
|