6061626364656667686970
class T1 extends Thread { @Override public void run() { sync.lockPage(1); t1locks[0] = Time.now(); hold.sleep(); sync.unlockAllPages(); } }
7273747576777879808182
class T2 extends Thread { @Override public void run() { sync.lockPage(1); t2locks[0] = Time.now(); sync.unlockAllPages(); } }
133134135136137138139140141142143
{ throw new RuntimeException("orly?"); } try { sync.lockPage(page1); sync.lockPage(page2); // have locks, increment the count counts[page1].incrementAndGet(); counts[page2].incrementAndGet();
134135136137138139140141142143144
throw new RuntimeException("orly?"); } try { sync.lockPage(page1); sync.lockPage(page2); // have locks, increment the count counts[page1].incrementAndGet(); counts[page2].incrementAndGet(); hits.incrementAndGet();