ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/loops/LockLoops.java
(Generate patch)

Comparing jsr166/src/test/loops/LockLoops.java (file contents):
Revision 1.5 by jsr166, Thu Sep 16 03:57:13 2010 UTC vs.
Revision 1.6 by jsr166, Mon Sep 27 19:15:15 2010 UTC

# Line 131 | Line 131 | public final class LockLoops {
131  
132      }
133  
134 <    static abstract class LockLoop implements Runnable {
134 >    abstract static class LockLoop implements Runnable {
135          int v;
136          int iters;
137          volatile int result;
# Line 198 | Line 198 | public final class LockLoops {
198      }
199  
200      private static class NoLockVolatileLoop extends LockLoop {
201 <        volatile private int vv;
201 >        private volatile int vv;
202          final int loop(int n) {
203              int sum = 0;
204              while (n-- > 0) {
# Line 211 | Line 211 | public final class LockLoops {
211      }
212  
213      private static class ReentrantLockLoop extends LockLoop {
214 <        final private ReentrantLock lock = new ReentrantLock();
214 >        private final ReentrantLock lock = new ReentrantLock();
215          final int loop(int n) {
216              int sum = 0;
217              while (n-- > 0) {
# Line 229 | Line 229 | public final class LockLoops {
229      }
230  
231      private static class FairReentrantLockLoop extends LockLoop {
232 <        final private ReentrantLock lock = new ReentrantLock(true);
232 >        private final ReentrantLock lock = new ReentrantLock(true);
233          final int loop(int n) {
234              int sum = 0;
235              while (n-- > 0) {
# Line 247 | Line 247 | public final class LockLoops {
247      }
248  
249      private static class ReentrantWriteLockLoop extends LockLoop {
250 <        final private Lock lock = new ReentrantReadWriteLock().writeLock();
250 >        private final Lock lock = new ReentrantReadWriteLock().writeLock();
251          final int loop(int n) {
252              int sum = 0;
253              while (n-- > 0) {
# Line 265 | Line 265 | public final class LockLoops {
265      }
266  
267      private static class ReentrantReadWriteLockLoop extends LockLoop {
268 <        final private ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
268 >        private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
269          final int loop(int n) {
270              int sum = 0;
271              while (n-- > 0) {
# Line 309 | Line 309 | public final class LockLoops {
309      }
310  
311      private static class SemaphoreLoop extends LockLoop {
312 <        final private Semaphore sem = new Semaphore(1, false);
312 >        private final Semaphore sem = new Semaphore(1, false);
313          final int loop(int n) {
314              int sum = 0;
315              try {
# Line 331 | Line 331 | public final class LockLoops {
331          }
332      }
333      private static class FairSemaphoreLoop extends LockLoop {
334 <        final private Semaphore sem = new Semaphore(1, true);
334 >        private final Semaphore sem = new Semaphore(1, true);
335          final int loop(int n) {
336              int sum = 0;
337              try {
# Line 354 | Line 354 | public final class LockLoops {
354      }
355  
356      private static class FairReentrantReadWriteLockLoop extends LockLoop {
357 <        final private ReentrantReadWriteLock lock = new ReentrantReadWriteLock(true);
357 >        private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(true);
358          final int loop(int n) {
359              int sum = 0;
360              while (n-- > 0) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines