for(int i = 0; i < NUM_TESTS; i++){
new Thread(new Runnable(){
private final ReadWriteLock rwl = new ReentrantReadWriteLock();
@Override
public void run() {
Random rand= new Random();
int min = 700, max = 10000;
int randomNum = rand.nextInt(max - min + 1) + min;
// try and throw threads of sequential access
try {
Thread.sleep(randomNum);
} catch (InterruptedException e) {
e.printStackTrace();
}
Lock rl = rwl.writeLock();
rl.lock();
atom.incrementAndGet();
rl.unlock();
Lock wl = rwl.readLock();
wl.lock();
System.out.println("threadId "+threadId +"lockOblect state "+atom.get());
wl.unlock();
threadId++;