@Test public void testMultipleConcurrentReaders() { List<Thread> threads = Lists.newArrayList(); final AtomicBoolean success = new AtomicBoolean(true); Runnable runnable = new Runnable() { @Override public void run() { if(!lock.readLock().tryLock()) { success.set(false); } } }; for (int i = 0; i < TestData.getScaleCount(); i++) { threads.add(new Thread(runnable)); } for (Thread thread : threads) { thread.start(); } Assert.assertTrue(success.get()); }
@Override public ReadLock readLock() { return readLock; }
ReadWriteSharedLock extends ReentrantReadWriteLock { @Override public ReadLock readLock() { return readLock; } }
ReadWriteSharedLock extends ReentrantReadWriteLock { @Override public ReadLock readLock() { return readLock; }  }
ReadWriteSharedLock extends ReentrantReadWriteLock { @Override public ReadLock readLock() { return readLock; }  int getReadHoldCount(); int getReadLockCount(); int getWriteHoldCount(); int getWriteLockCount(); boolean isWriteLockedByCurrentThread(); @Override ReadLock readLock(); @Override String toString(); @Override WriteLock writeLock(); }
ReadWriteSharedLock extends ReentrantReadWriteLock { @Override public ReadLock readLock() { return readLock; }  int getReadHoldCount(); int getReadLockCount(); int getWriteHoldCount(); int getWriteLockCount(); boolean isWriteLockedByCurrentThread(); @Override ReadLock readLock(); @Override String toString(); @Override WriteLock writeLock();  }