--- jsr166/src/test/loops/NoopSpinLockLoops.java 2007/02/19 00:46:06 1.2 +++ jsr166/src/test/loops/NoopSpinLockLoops.java 2009/11/03 01:04:02 1.4 @@ -17,7 +17,7 @@ public final class NoopSpinLockLoops { public static void main(String[] args) throws Exception { int maxThreads = 100; - if (args.length > 0) + if (args.length > 0) maxThreads = Integer.parseInt(args[0]); new ReentrantLockLoop(1).test(); @@ -32,8 +32,8 @@ public final class NoopSpinLockLoops { if (i == k) { k = i << 1; i = i + (i >>> 1); - } - else + } + else i = k; } pool.shutdown(); @@ -53,15 +53,15 @@ public final class NoopSpinLockLoops { } final void test() throws Exception { - for (int i = 0; i < nthreads; ++i) + for (int i = 0; i < nthreads; ++i) pool.execute(this); barrier.await(); barrier.await(); if (print) { long time = timer.getTime(); - long tpi = time / ((long)iters * nthreads); + long tpi = time / ((long) iters * nthreads); System.out.print("\t" + LoopHelpers.rightJustify(tpi) + " ns per lock"); - double secs = (double)(time) / 1000000000.0; + double secs = (double) time / 1000000000.0; System.out.println("\t " + secs + "s run time"); } @@ -73,7 +73,7 @@ public final class NoopSpinLockLoops { public final void run() { final AtomicInteger lock = this.spinlock; try { - barrier.await(); + barrier.await(); int sum = v + 1; int x = sum + 1; int n = iters; @@ -89,11 +89,10 @@ public final class NoopSpinLockLoops { barrier.await(); result += sum; } - catch (Exception ie) { - return; + catch (Exception ie) { + return; } } } } -