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.2 by dl, Mon Dec 29 01:18:40 2003 UTC vs.
Revision 1.4 by dl, Mon Dec 29 19:05:40 2003 UTC

# Line 30 | Line 30 | public class AbstractQueuedSynchronizerT
30       */
31      static class Mutex implements Lock, java.io.Serializable {
32          private static class Sync extends AbstractQueuedSynchronizer {
33 <            public int acquireExclusiveState(boolean isQueued, int acquires, Thread current) {
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;
36              }
# Line 40 | Line 40 | public class AbstractQueuedSynchronizerT
40                  return true;
41              }
42              
43 <            public int acquireSharedState(boolean isQueued, int acquires, Thread current) {
43 >            public int acquireSharedState(boolean isQueued, int acquires) {
44                  throw new UnsupportedOperationException();
45              }
46              
# Line 62 | Line 62 | public class AbstractQueuedSynchronizerT
62          
63          private final Sync sync = new Sync();
64          public boolean tryLock() {
65 <            return sync.acquireExclusiveState(false, 1, null) >= 0;
65 >            return sync.acquireExclusiveState(false, 1) >= 0;
66          }
67          public void lock() {
68 <            if (!tryLock()) sync.acquireExclusiveUninterruptibly(1);
68 >            sync.acquireExclusiveUninterruptibly(1);
69          }
70          public void lockInterruptibly() throws InterruptedException {
71              sync.acquireExclusiveInterruptibly(1);
# Line 119 | Line 119 | public class AbstractQueuedSynchronizerT
119      }
120  
121      /**
122 <     * trylock on an unlocked lock succeeds
122 >     * tryLock on an unlocked lock succeeds
123       */
124      public void testTryLock() {
125          Mutex rl = new Mutex();
# Line 158 | Line 158 | public class AbstractQueuedSynchronizerT
158      }
159  
160      /**
161 <     * timed trylock is interruptible.
161 >     * timed tryLock is interruptible.
162       */
163      public void testInterruptedException2() {
164          final Mutex lock = new Mutex();
# Line 181 | Line 181 | public class AbstractQueuedSynchronizerT
181  
182  
183      /**
184 <     * Trylock on a locked lock fails
184 >     * TryLock on a locked lock fails
185       */
186      public void testTryLockWhenLocked() {
187          final Mutex lock = new Mutex();
# Line 201 | Line 201 | public class AbstractQueuedSynchronizerT
201      }
202  
203      /**
204 <     * Timed trylock on a locked lock times out
204 >     * Timed tryLock on a locked lock times out
205       */
206      public void testTryLock_Timeout() {
207          final Mutex lock = new Mutex();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines