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

Comparing jsr166/src/test/tck/StampedLockTest.java (file contents):
Revision 1.27 by jsr166, Wed Aug 10 17:05:13 2016 UTC vs.
Revision 1.30 by jsr166, Sat Feb 18 00:32:30 2017 UTC

# Line 17 | Line 17 | import java.util.concurrent.TimeUnit;
17   import java.util.concurrent.locks.Lock;
18   import java.util.concurrent.locks.StampedLock;
19   import java.util.function.BiConsumer;
20 import java.util.function.Consumer;
20   import java.util.function.Function;
21  
22   import junit.framework.Test;
# Line 84 | Line 83 | public class StampedLockTest extends JSR
83  
84      List<Function<StampedLock, Long>> readLockers() {
85          List<Function<StampedLock, Long>> readLockers = new ArrayList<>();
86 <        readLockers.add((sl) -> sl.readLock());
87 <        readLockers.add((sl) -> sl.tryReadLock());
88 <        readLockers.add((sl) -> readLockInterruptiblyUninterrupted(sl));
89 <        readLockers.add((sl) -> tryReadLockUninterrupted(sl, Long.MIN_VALUE, DAYS));
90 <        readLockers.add((sl) -> tryReadLockUninterrupted(sl, 0L, DAYS));
91 <        readLockers.add((sl) -> sl.tryConvertToReadLock(sl.tryOptimisticRead()));
86 >        readLockers.add(sl -> sl.readLock());
87 >        readLockers.add(sl -> sl.tryReadLock());
88 >        readLockers.add(sl -> readLockInterruptiblyUninterrupted(sl));
89 >        readLockers.add(sl -> tryReadLockUninterrupted(sl, Long.MIN_VALUE, DAYS));
90 >        readLockers.add(sl -> tryReadLockUninterrupted(sl, 0L, DAYS));
91 >        readLockers.add(sl -> sl.tryConvertToReadLock(sl.tryOptimisticRead()));
92          return readLockers;
93      }
94  
# Line 105 | Line 104 | public class StampedLockTest extends JSR
104  
105      List<Function<StampedLock, Long>> writeLockers() {
106          List<Function<StampedLock, Long>> writeLockers = new ArrayList<>();
107 <        writeLockers.add((sl) -> sl.writeLock());
108 <        writeLockers.add((sl) -> sl.tryWriteLock());
109 <        writeLockers.add((sl) -> writeLockInterruptiblyUninterrupted(sl));
110 <        writeLockers.add((sl) -> tryWriteLockUninterrupted(sl, Long.MIN_VALUE, DAYS));
111 <        writeLockers.add((sl) -> tryWriteLockUninterrupted(sl, 0L, DAYS));
112 <        writeLockers.add((sl) -> sl.tryConvertToWriteLock(sl.tryOptimisticRead()));
107 >        writeLockers.add(sl -> sl.writeLock());
108 >        writeLockers.add(sl -> sl.tryWriteLock());
109 >        writeLockers.add(sl -> writeLockInterruptiblyUninterrupted(sl));
110 >        writeLockers.add(sl -> tryWriteLockUninterrupted(sl, Long.MIN_VALUE, DAYS));
111 >        writeLockers.add(sl -> tryWriteLockUninterrupted(sl, 0L, DAYS));
112 >        writeLockers.add(sl -> sl.tryConvertToWriteLock(sl.tryOptimisticRead()));
113          return writeLockers;
114      }
115  
# Line 273 | Line 272 | public class StampedLockTest extends JSR
272       * interruptible operations throw InterruptedException when pre-interrupted
273       */
274      public void testInterruptibleOperationsThrowInterruptedExceptionWhenPreInterrupted() {
276        final CountDownLatch running = new CountDownLatch(1);
275          final StampedLock lock = new StampedLock();
276  
277          Action[] interruptibleLockActions = {
# Line 338 | Line 336 | public class StampedLockTest extends JSR
336       * interruptible operations throw InterruptedException when write locked and interrupted
337       */
338      public void testInterruptibleOperationsThrowInterruptedExceptionWriteLockedInterrupted() {
341        final CountDownLatch running = new CountDownLatch(1);
339          final StampedLock lock = new StampedLock();
340          long s = lock.writeLock();
341  
# Line 361 | Line 358 | public class StampedLockTest extends JSR
358       * interruptible operations throw InterruptedException when read locked and interrupted
359       */
360      public void testInterruptibleOperationsThrowInterruptedExceptionReadLockedInterrupted() {
364        final CountDownLatch running = new CountDownLatch(1);
361          final StampedLock lock = new StampedLock();
362          long s = lock.readLock();
363  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines