--- jsr166/src/test/loops/CancelledLockLoops.java 2009/01/22 19:39:18 1.3 +++ jsr166/src/test/loops/CancelledLockLoops.java 2009/10/29 23:09:07 1.4 @@ -12,11 +12,11 @@ public final class CancelledLockLoops { static final Random rng = new Random(); static boolean print = false; static final int ITERS = 10000000; - static final long TIMEOUT = 100; + static final long TIMEOUT = 100; public static void main(String[] args) throws Exception { int maxThreads = 100; - if (args.length > 0) + if (args.length > 0) maxThreads = Integer.parseInt(args[0]); print = true; @@ -47,9 +47,9 @@ public final class CancelledLockLoops { final void test() throws Exception { Thread[] threads = new Thread[nthreads]; - for (int i = 0; i < threads.length; ++i) + for (int i = 0; i < threads.length; ++i) threads[i] = new Thread(this); - for (int i = 0; i < threads.length; ++i) + for (int i = 0; i < threads.length; ++i) threads[i].start(); Thread[] cancels = (Thread[]) (threads.clone()); Collections.shuffle(Arrays.asList(cancels), rng); @@ -58,7 +58,7 @@ public final class CancelledLockLoops { for (int i = 0; i < cancels.length-2; ++i) { cancels[i].interrupt(); // make sure all OK even when cancellations spaced out - if ( (i & 3) == 0) + if ( (i & 3) == 0) Thread.sleep(1 + rng.nextInt(10)); } barrier.await(); @@ -85,7 +85,7 @@ public final class CancelledLockLoops { public final void run() { try { - barrier.await(); + barrier.await(); int sum = v; int x = 0; int n = ITERS; @@ -106,7 +106,7 @@ public final class CancelledLockLoops { sum += LoopHelpers.compute2(x); } while (n-- > 0); if (n <= 0) { - lock.lock(); + lock.lock(); try { ++completed; } @@ -117,9 +117,9 @@ public final class CancelledLockLoops { barrier.await(); result += sum; } - catch (Exception ex) { + catch (Exception ex) { // ex.printStackTrace(); - return; + return; } } }