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

Comparing jsr166/src/test/tck/AbstractQueuedSynchronizerTest.java (file contents):
Revision 1.3 by dl, Mon Dec 29 14:19:27 2003 UTC vs.
Revision 1.5 by dl, Tue Dec 30 15:48:38 2003 UTC

# Line 32 | Line 32 | public class AbstractQueuedSynchronizerT
32          private static class Sync extends AbstractQueuedSynchronizer {
33              public int acquireExclusiveState(boolean isQueued, int acquires) {
34                  assert acquires == 1; // Does not use multiple acquires
35 <                return state().compareAndSet(0, 1)? 0 : -1;
35 >                return compareAndSet(0, 1)? 0 : -1;
36              }
37              
38              public boolean releaseExclusiveState(int releases) {
39 <                state().set(0);
39 >                set(0);
40                  return true;
41              }
42              
43            public int acquireSharedState(boolean isQueued, int acquires) {
44                throw new UnsupportedOperationException();
45            }
46            
47            public boolean releaseSharedState(int releases) {
48                throw new UnsupportedOperationException();
49            }
50            
43              public void checkConditionAccess(Thread thread, boolean waiting) {
44 <                if (state().get() == 0) throw new IllegalMonitorStateException();
44 >                if (get() == 0) throw new IllegalMonitorStateException();
45              }
46              
47              Condition newCondition() { return new ConditionObject(); }
48              
49              private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
50                  s.defaultReadObject();
51 <                state().set(0); // reset to unlocked state
51 >                set(0); // reset to unlocked state
52              }
53          }
54          
# Line 75 | Line 67 | public class AbstractQueuedSynchronizerT
67          }
68          public void unlock() { sync.releaseExclusive(1); }
69          public Condition newCondition() { return sync.newCondition(); }
70 <        public boolean isLocked() { return sync.state().get() != 0; }
70 >        public boolean isLocked() { return sync.get() != 0; }
71          public boolean hasQueuedThreads() { return sync.hasQueuedThreads(); }
72      }
73  
# Line 119 | Line 111 | public class AbstractQueuedSynchronizerT
111      }
112  
113      /**
114 <     * trylock on an unlocked lock succeeds
114 >     * tryLock on an unlocked lock succeeds
115       */
116      public void testTryLock() {
117          Mutex rl = new Mutex();
# Line 158 | Line 150 | public class AbstractQueuedSynchronizerT
150      }
151  
152      /**
153 <     * timed trylock is interruptible.
153 >     * timed tryLock is interruptible.
154       */
155      public void testInterruptedException2() {
156          final Mutex lock = new Mutex();
# Line 181 | Line 173 | public class AbstractQueuedSynchronizerT
173  
174  
175      /**
176 <     * Trylock on a locked lock fails
176 >     * TryLock on a locked lock fails
177       */
178      public void testTryLockWhenLocked() {
179          final Mutex lock = new Mutex();
# Line 201 | Line 193 | public class AbstractQueuedSynchronizerT
193      }
194  
195      /**
196 <     * Timed trylock on a locked lock times out
196 >     * Timed tryLock on a locked lock times out
197       */
198      public void testTryLock_Timeout() {
199          final Mutex lock = new Mutex();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines