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();
4344454647484950515253
@Test public void testReentrant() throws Exception { final PageAccessSynchronizer sync = new PageAccessSynchronizer(Duration.seconds(5)); final Duration hold = Duration.seconds(1); sync.lockPage(0); sync.lockPage(0); } @Test public void testBlocking() throws Exception
4445464748495051525354
public void testReentrant() throws Exception { final PageAccessSynchronizer sync = new PageAccessSynchronizer(Duration.seconds(5)); final Duration hold = Duration.seconds(1); sync.lockPage(0); sync.lockPage(0); } @Test public void testBlocking() throws Exception {
6061626364656667686970
class T1 extends Thread { @Override public void run() { sync.lockPage(1); t1locks[0] = Time.now(); hold.sleep(); sync.unlockAllPages(); } }
5051525354555657585960
@Test public void testReentrant() throws Exception { final PageAccessSynchronizer sync = new PageAccessSynchronizer(Duration.seconds(5)); final Duration hold = Duration.seconds(1); sync.lockPage(0); sync.lockPage(0); } /** * @throws Exception
5152535455565758596061
public void testReentrant() throws Exception { final PageAccessSynchronizer sync = new PageAccessSynchronizer(Duration.seconds(5)); final Duration hold = Duration.seconds(1); sync.lockPage(0); sync.lockPage(0); } /** * @throws Exception */
7071727374757677787980
8283848586878889909192