--- jsr166/src/test/tck/AbstractQueuedLongSynchronizerTest.java 2005/03/01 01:32:00 1.1 +++ jsr166/src/test/tck/AbstractQueuedLongSynchronizerTest.java 2009/11/17 13:40:14 1.8 @@ -2,8 +2,8 @@ * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/licenses/publicdomain - * Other contributors include Andrew Wright, Jeffrey Hayes, - * Pat Fisher, Mike Judd. + * Other contributors include Andrew Wright, Jeffrey Hayes, + * Pat Fisher, Mike Judd. */ @@ -32,35 +32,35 @@ public class AbstractQueuedLongSynchroni static class Mutex extends AbstractQueuedLongSynchronizer { // Use value > 32 bits for locked state static final long LOCKED = 1 << 48; - public boolean isHeldExclusively() { - return getState() == LOCKED; + public boolean isHeldExclusively() { + return getState() == LOCKED; } - + public boolean tryAcquire(long acquires) { return compareAndSetState(0, LOCKED); } - + public boolean tryRelease(long releases) { if (getState() == 0) throw new IllegalMonitorStateException(); setState(0); return true; } - + public AbstractQueuedLongSynchronizer.ConditionObject newCondition() { return new AbstractQueuedLongSynchronizer.ConditionObject(); } } - + /** * A simple latch class, to test shared mode. */ - static class BooleanLatch extends AbstractQueuedLongSynchronizer { + static class BooleanLatch extends AbstractQueuedLongSynchronizer { public boolean isSignalled() { return getState() != 0; } public long tryAcquireShared(long ignore) { return isSignalled()? 1 : -1; } - + public boolean tryReleaseShared(long ignore) { setState(1 << 62); return true; @@ -76,7 +76,7 @@ public class AbstractQueuedLongSynchroni public void run() { try { sync.acquireInterruptibly(1); - } catch(InterruptedException success){} + } catch (InterruptedException success) {} } } @@ -92,22 +92,22 @@ public class AbstractQueuedLongSynchroni try { sync.acquireInterruptibly(1); threadShouldThrow(); - } catch(InterruptedException success){} + } catch (InterruptedException success) {} } } /** * isHeldExclusively is false upon construction */ - public void testIsHeldExclusively() { + public void testIsHeldExclusively() { Mutex rl = new Mutex(); assertFalse(rl.isHeldExclusively()); } - + /** * acquiring released sync succeeds */ - public void testAcquire() { + public void testAcquire() { Mutex rl = new Mutex(); rl.acquire(1); assertTrue(rl.isHeldExclusively()); @@ -118,7 +118,7 @@ public class AbstractQueuedLongSynchroni /** * tryAcquire on an released sync succeeds */ - public void testTryAcquire() { + public void testTryAcquire() { Mutex rl = new Mutex(); assertTrue(rl.tryAcquire(1)); assertTrue(rl.isHeldExclusively()); @@ -128,7 +128,7 @@ public class AbstractQueuedLongSynchroni /** * hasQueuedThreads reports whether there are waiting threads */ - public void testhasQueuedThreads() { + public void testhasQueuedThreads() { final Mutex sync = new Mutex(); Thread t1 = new Thread(new InterruptedSyncRunnable(sync)); Thread t2 = new Thread(new InterruptibleSyncRunnable(sync)); @@ -149,15 +149,15 @@ public class AbstractQueuedLongSynchroni assertFalse(sync.hasQueuedThreads()); t1.join(); t2.join(); - } catch(Exception e){ + } catch (Exception e) { unexpectedException(); } - } + } /** * isQueued(null) throws NPE */ - public void testIsQueuedNPE() { + public void testIsQueuedNPE() { final Mutex sync = new Mutex(); try { sync.isQueued(null); @@ -169,7 +169,7 @@ public class AbstractQueuedLongSynchroni /** * isQueued reports whether a thread is queued. */ - public void testIsQueued() { + public void testIsQueued() { final Mutex sync = new Mutex(); Thread t1 = new Thread(new InterruptedSyncRunnable(sync)); Thread t2 = new Thread(new InterruptibleSyncRunnable(sync)); @@ -195,15 +195,15 @@ public class AbstractQueuedLongSynchroni assertFalse(sync.isQueued(t2)); t1.join(); t2.join(); - } catch(Exception e){ + } catch (Exception e) { unexpectedException(); } - } + } /** * getFirstQueuedThread returns first waiting thread or null if none */ - public void testGetFirstQueuedThread() { + public void testGetFirstQueuedThread() { final Mutex sync = new Mutex(); Thread t1 = new Thread(new InterruptedSyncRunnable(sync)); Thread t2 = new Thread(new InterruptibleSyncRunnable(sync)); @@ -225,16 +225,16 @@ public class AbstractQueuedLongSynchroni assertNull(sync.getFirstQueuedThread()); t1.join(); t2.join(); - } catch(Exception e){ + } catch (Exception e) { unexpectedException(); } - } + } /** * hasContended reports false if no thread has ever blocked, else true */ - public void testHasContended() { + public void testHasContended() { final Mutex sync = new Mutex(); Thread t1 = new Thread(new InterruptedSyncRunnable(sync)); Thread t2 = new Thread(new InterruptibleSyncRunnable(sync)); @@ -255,15 +255,15 @@ public class AbstractQueuedLongSynchroni assertTrue(sync.hasContended()); t1.join(); t2.join(); - } catch(Exception e){ + } catch (Exception e) { unexpectedException(); } - } + } /** * getQueuedThreads includes waiting threads */ - public void testGetQueuedThreads() { + public void testGetQueuedThreads() { final Mutex sync = new Mutex(); Thread t1 = new Thread(new InterruptedSyncRunnable(sync)); Thread t2 = new Thread(new InterruptibleSyncRunnable(sync)); @@ -287,15 +287,15 @@ public class AbstractQueuedLongSynchroni assertTrue(sync.getQueuedThreads().isEmpty()); t1.join(); t2.join(); - } catch(Exception e){ + } catch (Exception e) { unexpectedException(); } - } + } /** * getExclusiveQueuedThreads includes waiting threads */ - public void testGetExclusiveQueuedThreads() { + public void testGetExclusiveQueuedThreads() { final Mutex sync = new Mutex(); Thread t1 = new Thread(new InterruptedSyncRunnable(sync)); Thread t2 = new Thread(new InterruptibleSyncRunnable(sync)); @@ -319,15 +319,15 @@ public class AbstractQueuedLongSynchroni assertTrue(sync.getExclusiveQueuedThreads().isEmpty()); t1.join(); t2.join(); - } catch(Exception e){ + } catch (Exception e) { unexpectedException(); } - } + } /** * getSharedQueuedThreads does not include exclusively waiting threads */ - public void testGetSharedQueuedThreads() { + public void testGetSharedQueuedThreads() { final Mutex sync = new Mutex(); Thread t1 = new Thread(new InterruptedSyncRunnable(sync)); Thread t2 = new Thread(new InterruptibleSyncRunnable(sync)); @@ -349,15 +349,15 @@ public class AbstractQueuedLongSynchroni assertTrue(sync.getSharedQueuedThreads().isEmpty()); t1.join(); t2.join(); - } catch(Exception e){ + } catch (Exception e) { unexpectedException(); } - } + } /** * tryAcquireNanos is interruptible. */ - public void testInterruptedException2() { + public void testInterruptedException2() { final Mutex sync = new Mutex(); sync.acquire(1); Thread t = new Thread(new Runnable() { @@ -365,13 +365,13 @@ public class AbstractQueuedLongSynchroni try { sync.tryAcquireNanos(1, MEDIUM_DELAY_MS * 1000 * 1000); threadShouldThrow(); - } catch(InterruptedException success){} + } catch (InterruptedException success) {} } }); try { t.start(); t.interrupt(); - } catch(Exception e){ + } catch (Exception e) { unexpectedException(); } } @@ -380,7 +380,7 @@ public class AbstractQueuedLongSynchroni /** * TryAcquire on exclusively held sync fails */ - public void testTryAcquireWhenSynced() { + public void testTryAcquireWhenSynced() { final Mutex sync = new Mutex(); sync.acquire(1); Thread t = new Thread(new Runnable() { @@ -392,15 +392,15 @@ public class AbstractQueuedLongSynchroni t.start(); t.join(); sync.release(1); - } catch(Exception e){ + } catch (Exception e) { unexpectedException(); } - } + } /** * tryAcquireNanos on an exclusively held sync times out */ - public void testAcquireNanos_Timeout() { + public void testAcquireNanos_Timeout() { final Mutex sync = new Mutex(); sync.acquire(1); Thread t = new Thread(new Runnable() { @@ -408,7 +408,7 @@ public class AbstractQueuedLongSynchroni try { threadAssertFalse(sync.tryAcquireNanos(1, 1000 * 1000)); } catch (Exception ex) { - threadUnexpectedException(); + threadUnexpectedException(ex); } } }); @@ -416,12 +416,12 @@ public class AbstractQueuedLongSynchroni t.start(); t.join(); sync.release(1); - } catch(Exception e){ + } catch (Exception e) { unexpectedException(); } - } - - + } + + /** * getState is true when acquired and false when not */ @@ -431,14 +431,14 @@ public class AbstractQueuedLongSynchroni assertTrue(sync.isHeldExclusively()); sync.release(1); assertFalse(sync.isHeldExclusively()); - Thread t = new Thread(new Runnable() { + Thread t = new Thread(new Runnable() { public void run() { sync.acquire(1); try { Thread.sleep(SMALL_DELAY_MS); } - catch(Exception e) { - threadUnexpectedException(); + catch (Exception e) { + threadUnexpectedException(e); } sync.release(1); } @@ -449,7 +449,7 @@ public class AbstractQueuedLongSynchroni assertTrue(sync.isHeldExclusively()); t.join(); assertFalse(sync.isHeldExclusively()); - } catch(Exception e){ + } catch (Exception e) { unexpectedException(); } } @@ -458,28 +458,30 @@ public class AbstractQueuedLongSynchroni /** * acquireInterruptibly is interruptible. */ - public void testAcquireInterruptibly1() { + public void testAcquireInterruptibly1() { final Mutex sync = new Mutex(); sync.acquire(1); Thread t = new Thread(new InterruptedSyncRunnable(sync)); try { t.start(); + Thread.sleep(SHORT_DELAY_MS); t.interrupt(); + Thread.sleep(SHORT_DELAY_MS); sync.release(1); t.join(); - } catch(Exception e){ + } catch (Exception e) { unexpectedException(); } - } + } /** * acquireInterruptibly succeeds when released, else is interruptible */ public void testAcquireInterruptibly2() { - final Mutex sync = new Mutex(); + final Mutex sync = new Mutex(); try { sync.acquireInterruptibly(1); - } catch(Exception e) { + } catch (Exception e) { unexpectedException(); } Thread t = new Thread(new InterruptedSyncRunnable(sync)); @@ -488,7 +490,7 @@ public class AbstractQueuedLongSynchroni t.interrupt(); assertTrue(sync.isHeldExclusively()); t.join(); - } catch(Exception e){ + } catch (Exception e) { unexpectedException(); } } @@ -497,7 +499,7 @@ public class AbstractQueuedLongSynchroni * owns is true for a condition created by sync else false */ public void testOwns() { - final Mutex sync = new Mutex(); + final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); final Mutex sync2 = new Mutex(); assertTrue(sync.owns(c)); @@ -508,7 +510,7 @@ public class AbstractQueuedLongSynchroni * Calling await without holding sync throws IllegalMonitorStateException */ public void testAwait_IllegalMonitor() { - final Mutex sync = new Mutex(); + final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); try { c.await(); @@ -525,7 +527,7 @@ public class AbstractQueuedLongSynchroni * Calling signal without holding sync throws IllegalMonitorStateException */ public void testSignal_IllegalMonitor() { - final Mutex sync = new Mutex(); + final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); try { c.signal(); @@ -542,7 +544,7 @@ public class AbstractQueuedLongSynchroni * awaitNanos without a signal times out */ public void testAwaitNanos_Timeout() { - final Mutex sync = new Mutex(); + final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); try { sync.acquire(1); @@ -559,7 +561,7 @@ public class AbstractQueuedLongSynchroni * Timed await without a signal times out */ public void testAwait_Timeout() { - final Mutex sync = new Mutex(); + final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); try { sync.acquire(1); @@ -575,7 +577,7 @@ public class AbstractQueuedLongSynchroni * awaitUntil without a signal times out */ public void testAwaitUntil_Timeout() { - final Mutex sync = new Mutex(); + final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); try { sync.acquire(1); @@ -592,17 +594,17 @@ public class AbstractQueuedLongSynchroni * await returns when signalled */ public void testAwait() { - final Mutex sync = new Mutex(); + final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); - Thread t = new Thread(new Runnable() { + Thread t = new Thread(new Runnable() { public void run() { try { sync.acquire(1); c.await(); sync.release(1); } - catch(InterruptedException e) { - threadUnexpectedException(); + catch (InterruptedException e) { + threadUnexpectedException(e); } } }); @@ -672,7 +674,7 @@ public class AbstractQueuedLongSynchroni */ public void testHasWaitersIAE() { final Mutex sync = new Mutex(); - final AbstractQueuedLongSynchronizer.ConditionObject c = (sync.newCondition()); + final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); final Mutex sync2 = new Mutex(); try { sync2.hasWaiters(c); @@ -688,7 +690,7 @@ public class AbstractQueuedLongSynchroni */ public void testHasWaitersIMSE() { final Mutex sync = new Mutex(); - final AbstractQueuedLongSynchronizer.ConditionObject c = (sync.newCondition()); + final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); try { sync.hasWaiters(c); shouldThrow(); @@ -704,7 +706,7 @@ public class AbstractQueuedLongSynchroni */ public void testGetWaitQueueLengthIAE() { final Mutex sync = new Mutex(); - final AbstractQueuedLongSynchronizer.ConditionObject c = (sync.newCondition()); + final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); final Mutex sync2 = new Mutex(); try { sync2.getWaitQueueLength(c); @@ -720,7 +722,7 @@ public class AbstractQueuedLongSynchroni */ public void testGetWaitQueueLengthIMSE() { final Mutex sync = new Mutex(); - final AbstractQueuedLongSynchronizer.ConditionObject c = (sync.newCondition()); + final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); try { sync.getWaitQueueLength(c); shouldThrow(); @@ -735,9 +737,9 @@ public class AbstractQueuedLongSynchroni * getWaitingThreads throws IAE if not owned */ public void testGetWaitingThreadsIAE() { - final Mutex sync = new Mutex(); - final AbstractQueuedLongSynchronizer.ConditionObject c = (sync.newCondition()); - final Mutex sync2 = new Mutex(); + final Mutex sync = new Mutex(); + final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); + final Mutex sync2 = new Mutex(); try { sync2.getWaitingThreads(c); shouldThrow(); @@ -751,8 +753,8 @@ public class AbstractQueuedLongSynchroni * getWaitingThreads throws IMSE if not synced */ public void testGetWaitingThreadsIMSE() { - final Mutex sync = new Mutex(); - final AbstractQueuedLongSynchronizer.ConditionObject c = (sync.newCondition()); + final Mutex sync = new Mutex(); + final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); try { sync.getWaitingThreads(c); shouldThrow(); @@ -768,9 +770,9 @@ public class AbstractQueuedLongSynchroni * hasWaiters returns true when a thread is waiting, else false */ public void testHasWaiters() { - final Mutex sync = new Mutex(); + final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); - Thread t = new Thread(new Runnable() { + Thread t = new Thread(new Runnable() { public void run() { try { sync.acquire(1); @@ -779,8 +781,8 @@ public class AbstractQueuedLongSynchroni c.await(); sync.release(1); } - catch(InterruptedException e) { - threadUnexpectedException(); + catch (InterruptedException e) { + threadUnexpectedException(e); } } }); @@ -810,9 +812,9 @@ public class AbstractQueuedLongSynchroni * getWaitQueueLength returns number of waiting threads */ public void testGetWaitQueueLength() { - final Mutex sync = new Mutex(); + final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); - Thread t1 = new Thread(new Runnable() { + Thread t1 = new Thread(new Runnable() { public void run() { try { sync.acquire(1); @@ -821,13 +823,13 @@ public class AbstractQueuedLongSynchroni c.await(); sync.release(1); } - catch(InterruptedException e) { - threadUnexpectedException(); + catch (InterruptedException e) { + threadUnexpectedException(e); } } }); - Thread t2 = new Thread(new Runnable() { + Thread t2 = new Thread(new Runnable() { public void run() { try { sync.acquire(1); @@ -836,8 +838,8 @@ public class AbstractQueuedLongSynchroni c.await(); sync.release(1); } - catch(InterruptedException e) { - threadUnexpectedException(); + catch (InterruptedException e) { + threadUnexpectedException(e); } } }); @@ -871,9 +873,9 @@ public class AbstractQueuedLongSynchroni * getWaitingThreads returns only and all waiting threads */ public void testGetWaitingThreads() { - final Mutex sync = new Mutex(); + final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); - Thread t1 = new Thread(new Runnable() { + Thread t1 = new Thread(new Runnable() { public void run() { try { sync.acquire(1); @@ -881,13 +883,13 @@ public class AbstractQueuedLongSynchroni c.await(); sync.release(1); } - catch(InterruptedException e) { - threadUnexpectedException(); + catch (InterruptedException e) { + threadUnexpectedException(e); } } }); - Thread t2 = new Thread(new Runnable() { + Thread t2 = new Thread(new Runnable() { public void run() { try { sync.acquire(1); @@ -895,8 +897,8 @@ public class AbstractQueuedLongSynchroni c.await(); sync.release(1); } - catch(InterruptedException e) { - threadUnexpectedException(); + catch (InterruptedException e) { + threadUnexpectedException(e); } } }); @@ -936,9 +938,9 @@ public class AbstractQueuedLongSynchroni * awaitUninterruptibly doesn't abort on interrupt */ public void testAwaitUninterruptibly() { - final Mutex sync = new Mutex(); + final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); - Thread t = new Thread(new Runnable() { + Thread t = new Thread(new Runnable() { public void run() { sync.acquire(1); c.awaitUninterruptibly(); @@ -953,7 +955,6 @@ public class AbstractQueuedLongSynchroni sync.acquire(1); c.signal(); sync.release(1); - assert(t.isInterrupted()); t.join(SHORT_DELAY_MS); assertFalse(t.isAlive()); } @@ -966,9 +967,9 @@ public class AbstractQueuedLongSynchroni * await is interruptible */ public void testAwait_Interrupt() { - final Mutex sync = new Mutex(); + final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); - Thread t = new Thread(new Runnable() { + Thread t = new Thread(new Runnable() { public void run() { try { sync.acquire(1); @@ -976,7 +977,7 @@ public class AbstractQueuedLongSynchroni sync.release(1); threadShouldThrow(); } - catch(InterruptedException success) { + catch (InterruptedException success) { } } }); @@ -997,9 +998,9 @@ public class AbstractQueuedLongSynchroni * awaitNanos is interruptible */ public void testAwaitNanos_Interrupt() { - final Mutex sync = new Mutex(); + final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); - Thread t = new Thread(new Runnable() { + Thread t = new Thread(new Runnable() { public void run() { try { sync.acquire(1); @@ -1007,7 +1008,7 @@ public class AbstractQueuedLongSynchroni sync.release(1); threadShouldThrow(); } - catch(InterruptedException success) { + catch (InterruptedException success) { } } }); @@ -1028,9 +1029,9 @@ public class AbstractQueuedLongSynchroni * awaitUntil is interruptible */ public void testAwaitUntil_Interrupt() { - final Mutex sync = new Mutex(); + final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); - Thread t = new Thread(new Runnable() { + Thread t = new Thread(new Runnable() { public void run() { try { sync.acquire(1); @@ -1039,7 +1040,7 @@ public class AbstractQueuedLongSynchroni sync.release(1); threadShouldThrow(); } - catch(InterruptedException success) { + catch (InterruptedException success) { } } }); @@ -1060,29 +1061,29 @@ public class AbstractQueuedLongSynchroni * signalAll wakes up all threads */ public void testSignalAll() { - final Mutex sync = new Mutex(); + final Mutex sync = new Mutex(); final AbstractQueuedLongSynchronizer.ConditionObject c = sync.newCondition(); - Thread t1 = new Thread(new Runnable() { + Thread t1 = new Thread(new Runnable() { public void run() { try { sync.acquire(1); c.await(); sync.release(1); } - catch(InterruptedException e) { + catch (InterruptedException e) { threadUnexpectedException(); } } }); - Thread t2 = new Thread(new Runnable() { + Thread t2 = new Thread(new Runnable() { public void run() { try { sync.acquire(1); c.await(); sync.release(1); } - catch(InterruptedException e) { + catch (InterruptedException e) { threadUnexpectedException(); } } @@ -1136,7 +1137,7 @@ public class AbstractQueuedLongSynchroni ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); Mutex r = (Mutex) in.readObject(); assertTrue(r.isHeldExclusively()); - } catch(Exception e){ + } catch (Exception e) { e.printStackTrace(); unexpectedException(); } @@ -1177,7 +1178,7 @@ public class AbstractQueuedLongSynchroni threadAssertFalse(l.isSignalled()); l.acquireSharedInterruptibly(0); threadAssertTrue(l.isSignalled()); - } catch(InterruptedException e){ + } catch (InterruptedException e) { threadUnexpectedException(); } } @@ -1189,11 +1190,11 @@ public class AbstractQueuedLongSynchroni l.releaseShared(0); assertTrue(l.isSignalled()); t.join(); - } catch (InterruptedException e){ + } catch (InterruptedException e) { unexpectedException(); } } - + /** * acquireSharedTimed returns after release @@ -1208,7 +1209,7 @@ public class AbstractQueuedLongSynchroni threadAssertTrue(l.tryAcquireSharedNanos(0, MEDIUM_DELAY_MS* 1000 * 1000)); threadAssertTrue(l.isSignalled()); - } catch(InterruptedException e){ + } catch (InterruptedException e) { threadUnexpectedException(); } } @@ -1220,11 +1221,11 @@ public class AbstractQueuedLongSynchroni l.releaseShared(0); assertTrue(l.isSignalled()); t.join(); - } catch (InterruptedException e){ + } catch (InterruptedException e) { unexpectedException(); } } - + /** * acquireSharedInterruptibly throws IE if interrupted before released */ @@ -1236,7 +1237,7 @@ public class AbstractQueuedLongSynchroni threadAssertFalse(l.isSignalled()); l.acquireSharedInterruptibly(0); threadShouldThrow(); - } catch(InterruptedException success){} + } catch (InterruptedException success) {} } }); t.start(); @@ -1244,7 +1245,7 @@ public class AbstractQueuedLongSynchroni assertFalse(l.isSignalled()); t.interrupt(); t.join(); - } catch (InterruptedException e){ + } catch (InterruptedException e) { unexpectedException(); } } @@ -1259,8 +1260,8 @@ public class AbstractQueuedLongSynchroni try { threadAssertFalse(l.isSignalled()); l.tryAcquireSharedNanos(0, SMALL_DELAY_MS* 1000 * 1000); - threadShouldThrow(); - } catch(InterruptedException success){} + threadShouldThrow(); + } catch (InterruptedException success) {} } }); t.start(); @@ -1269,7 +1270,7 @@ public class AbstractQueuedLongSynchroni assertFalse(l.isSignalled()); t.interrupt(); t.join(); - } catch (InterruptedException e){ + } catch (InterruptedException e) { unexpectedException(); } } @@ -1284,7 +1285,7 @@ public class AbstractQueuedLongSynchroni try { threadAssertFalse(l.isSignalled()); threadAssertFalse(l.tryAcquireSharedNanos(0, SMALL_DELAY_MS* 1000 * 1000)); - } catch(InterruptedException ie){ + } catch (InterruptedException ie) { threadUnexpectedException(); } } @@ -1294,10 +1295,10 @@ public class AbstractQueuedLongSynchroni Thread.sleep(SHORT_DELAY_MS); assertFalse(l.isSignalled()); t.join(); - } catch (InterruptedException e){ + } catch (InterruptedException e) { unexpectedException(); } } - + }