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

Comparing jsr166/src/test/tck/LockSupportTest.java (file contents):
Revision 1.22 by jsr166, Fri May 27 19:44:42 2011 UTC vs.
Revision 1.23 by jsr166, Sat May 28 22:21:58 2011 UTC

# Line 8 | Line 8
8   */
9  
10   import junit.framework.*;
11 < import java.util.*;
12 < import java.util.concurrent.*;
11 > import java.util.concurrent.CountDownLatch;
12   import java.util.concurrent.atomic.AtomicBoolean;
13 < import java.util.concurrent.locks.*;
13 > import java.util.concurrent.locks.LockSupport;
14 > import static java.util.concurrent.TimeUnit.MILLISECONDS;
15  
16   public class LockSupportTest extends JSR166TestCase {
17      public static void main(String[] args) {
# Line 23 | Line 23 | public class LockSupportTest extends JSR
23      }
24  
25      /**
26 <     * park is released by subsequent unpark
26 >     * Returns the blocker object used by tests in this file.
27 >     * Any old object will do; we'll return a convenient one.
28       */
29 <    public void testParkBeforeUnpark() throws InterruptedException {
30 <        final CountDownLatch threadStarted = new CountDownLatch(1);
30 <        Thread t = newStartedThread(new CheckedRunnable() {
31 <            public void realRun() {
32 <                threadStarted.countDown();
33 <                LockSupport.park();
34 <            }});
35 <
36 <        threadStarted.await();
37 <        delay(SHORT_DELAY_MS);
38 <        LockSupport.unpark(t);
39 <        awaitTermination(t, MEDIUM_DELAY_MS);
29 >    static Object theBlocker() {
30 >        return LockSupportTest.class;
31      }
32  
33 <    /**
34 <     * parkUntil is released by subsequent unpark
35 <     */
36 <    public void testParkUntilBeforeUnpark() throws InterruptedException {
37 <        final CountDownLatch threadStarted = new CountDownLatch(1);
38 <        Thread t = newStartedThread(new CheckedRunnable() {
39 <            public void realRun() {
40 <                long d = new Date().getTime() + LONG_DELAY_MS;
41 <                long nanos = LONG_DELAY_MS * 1000L * 1000L;
42 <                long t0 = System.nanoTime();
43 <                threadStarted.countDown();
44 <                LockSupport.parkUntil(d);
45 <                assertTrue(System.nanoTime() - t0 < nanos);
46 <            }});
47 <
48 <        threadStarted.await();
49 <        delay(SHORT_DELAY_MS);
50 <        LockSupport.unpark(t);
51 <        awaitTermination(t, MEDIUM_DELAY_MS);
33 >    enum ParkMethod {
34 >        park() {
35 >            void park() {
36 >                LockSupport.park();
37 >            }
38 >            void park(long millis) {
39 >                throw new UnsupportedOperationException();
40 >            }
41 >        },
42 >        parkUntil() {
43 >            void park(long millis) {
44 >                LockSupport.parkUntil(deadline(millis));
45 >            }
46 >        },
47 >        parkNanos() {
48 >            void park(long millis) {
49 >                LockSupport.parkNanos(MILLISECONDS.toNanos(millis));
50 >            }
51 >        },
52 >        parkBlocker() {
53 >            void park() {
54 >                LockSupport.park(theBlocker());
55 >            }
56 >            void park(long millis) {
57 >                throw new UnsupportedOperationException();
58 >            }
59 >        },
60 >        parkUntilBlocker() {
61 >            void park(long millis) {
62 >                LockSupport.parkUntil(theBlocker(), deadline(millis));
63 >            }
64 >        },
65 >        parkNanosBlocker() {
66 >            void park(long millis) {
67 >                LockSupport.parkNanos(theBlocker(),
68 >                                      MILLISECONDS.toNanos(millis));
69 >            }
70 >        };
71 >
72 >        void park() { park(2 * LONG_DELAY_MS); }
73 >        abstract void park(long millis);
74 >
75 >        /** Returns a deadline to use with parkUntil. */
76 >        long deadline(long millis) {
77 >            // beware of rounding
78 >            return System.currentTimeMillis() + millis + 1;
79 >        }
80      }
81  
82      /**
83 <     * parkNanos is released by subsequent unpark
83 >     * park is released by subsequent unpark
84       */
85 <    public void testParkNanosBeforeUnpark() throws InterruptedException {
86 <        final CountDownLatch threadStarted = new CountDownLatch(1);
85 >    public void testParkBeforeUnpark_park() {
86 >        testParkBeforeUnpark(ParkMethod.park);
87 >    }
88 >    public void testParkBeforeUnpark_parkNanos() {
89 >        testParkBeforeUnpark(ParkMethod.parkNanos);
90 >    }
91 >    public void testParkBeforeUnpark_parkUntil() {
92 >        testParkBeforeUnpark(ParkMethod.parkUntil);
93 >    }
94 >    public void testParkBeforeUnpark_parkBlocker() {
95 >        testParkBeforeUnpark(ParkMethod.parkBlocker);
96 >    }
97 >    public void testParkBeforeUnpark_parkNanosBlocker() {
98 >        testParkBeforeUnpark(ParkMethod.parkNanosBlocker);
99 >    }
100 >    public void testParkBeforeUnpark_parkUntilBlocker() {
101 >        testParkBeforeUnpark(ParkMethod.parkUntilBlocker);
102 >    }
103 >    public void testParkBeforeUnpark(final ParkMethod parkMethod) {
104 >        final CountDownLatch pleaseUnpark = new CountDownLatch(1);
105          Thread t = newStartedThread(new CheckedRunnable() {
106              public void realRun() {
107 <                long nanos = LONG_DELAY_MS * 1000L * 1000L;
108 <                long t0 = System.nanoTime();
72 <                threadStarted.countDown();
73 <                LockSupport.parkNanos(nanos);
74 <                assertTrue(System.nanoTime() - t0 < nanos);
107 >                pleaseUnpark.countDown();
108 >                parkMethod.park();
109              }});
110  
111 <        threadStarted.await();
78 <        delay(SHORT_DELAY_MS);
111 >        await(pleaseUnpark);
112          LockSupport.unpark(t);
113 <        awaitTermination(t, MEDIUM_DELAY_MS);
113 >        awaitTermination(t);
114      }
115  
116      /**
117       * park is released by preceding unpark
118       */
119 <    public void testParkAfterUnpark() throws Exception {
120 <        final CountDownLatch threadStarted = new CountDownLatch(1);
88 <        final AtomicBoolean unparked = new AtomicBoolean(false);
89 <        Thread t = newStartedThread(new CheckedRunnable() {
90 <            public void realRun() throws Exception {
91 <                threadStarted.countDown();
92 <                while (!unparked.get())
93 <                    Thread.yield();
94 <                LockSupport.park();
95 <            }});
96 <
97 <        threadStarted.await();
98 <        LockSupport.unpark(t);
99 <        unparked.set(true);
100 <        awaitTermination(t, MEDIUM_DELAY_MS);
119 >    public void testParkAfterUnpark_park() {
120 >        testParkAfterUnpark(ParkMethod.park);
121      }
122 <
123 <    /**
104 <     * parkUntil is released by preceding unpark
105 <     */
106 <    public void testParkUntilAfterUnpark() throws Exception {
107 <        final CountDownLatch threadStarted = new CountDownLatch(1);
108 <        final AtomicBoolean unparked = new AtomicBoolean(false);
109 <        Thread t = newStartedThread(new CheckedRunnable() {
110 <            public void realRun() throws Exception {
111 <                threadStarted.countDown();
112 <                while (!unparked.get())
113 <                    Thread.yield();
114 <                long d = new Date().getTime() + LONG_DELAY_MS;
115 <                long nanos = LONG_DELAY_MS * 1000L * 1000L;
116 <                long t0 = System.nanoTime();
117 <                LockSupport.parkUntil(d);
118 <                assertTrue(System.nanoTime() - t0 < nanos);
119 <            }});
120 <
121 <        threadStarted.await();
122 <        LockSupport.unpark(t);
123 <        unparked.set(true);
124 <        awaitTermination(t, MEDIUM_DELAY_MS);
122 >    public void testParkAfterUnpark_parkNanos() {
123 >        testParkAfterUnpark(ParkMethod.parkNanos);
124      }
125 <
126 <    /**
127 <     * parkNanos is released by preceding unpark
128 <     */
129 <    public void testParkNanosAfterUnpark() throws Exception {
130 <        final CountDownLatch threadStarted = new CountDownLatch(1);
131 <        final AtomicBoolean unparked = new AtomicBoolean(false);
125 >    public void testParkAfterUnpark_parkUntil() {
126 >        testParkAfterUnpark(ParkMethod.parkUntil);
127 >    }
128 >    public void testParkAfterUnpark_parkBlocker() {
129 >        testParkAfterUnpark(ParkMethod.parkBlocker);
130 >    }
131 >    public void testParkAfterUnpark_parkNanosBlocker() {
132 >        testParkAfterUnpark(ParkMethod.parkNanosBlocker);
133 >    }
134 >    public void testParkAfterUnpark_parkUntilBlocker() {
135 >        testParkAfterUnpark(ParkMethod.parkUntilBlocker);
136 >    }
137 >    public void testParkAfterUnpark(final ParkMethod parkMethod) {
138 >        final CountDownLatch pleaseUnpark = new CountDownLatch(1);
139 >        final AtomicBoolean pleasePark = new AtomicBoolean(false);
140          Thread t = newStartedThread(new CheckedRunnable() {
141 <            public void realRun() throws Exception {
142 <                threadStarted.countDown();
143 <                while (!unparked.get())
141 >            public void realRun() {
142 >                pleaseUnpark.countDown();
143 >                while (!pleasePark.get())
144                      Thread.yield();
145 <                long nanos = LONG_DELAY_MS * 1000L * 1000L;
139 <                long t0 = System.nanoTime();
140 <                LockSupport.parkNanos(nanos);
141 <                assertTrue(System.nanoTime() - t0 < nanos);
145 >                parkMethod.park();
146              }});
147  
148 <        threadStarted.await();
148 >        await(pleaseUnpark);
149          LockSupport.unpark(t);
150 <        unparked.set(true);
151 <        awaitTermination(t, MEDIUM_DELAY_MS);
150 >        pleasePark.set(true);
151 >        awaitTermination(t);
152      }
153  
154      /**
155       * park is released by subsequent interrupt
156       */
157 <    public void testParkBeforeInterrupt() throws InterruptedException {
158 <        final CountDownLatch threadStarted = new CountDownLatch(1);
155 <        Thread t = newStartedThread(new CheckedRunnable() {
156 <            public void realRun() {
157 <                assertFalse(Thread.currentThread().isInterrupted());
158 <                threadStarted.countDown();
159 <                do {
160 <                    LockSupport.park();
161 <                    // park may return spuriously
162 <                } while (! Thread.currentThread().isInterrupted());
163 <            }});
164 <
165 <        threadStarted.await();
166 <        delay(SHORT_DELAY_MS);
167 <        t.interrupt();
168 <        awaitTermination(t, MEDIUM_DELAY_MS);
157 >    public void testParkBeforeInterrupt_park() {
158 >        testParkBeforeInterrupt(ParkMethod.park);
159      }
160 <
161 <    /**
172 <     * parkUntil is released by subsequent interrupt
173 <     */
174 <    public void testParkUntilBeforeInterrupt() throws InterruptedException {
175 <        final CountDownLatch threadStarted = new CountDownLatch(1);
176 <        Thread t = newStartedThread(new CheckedRunnable() {
177 <            public void realRun() {
178 <                long d = new Date().getTime() + LONG_DELAY_MS;
179 <                long nanos = LONG_DELAY_MS * 1000L * 1000L;
180 <                long t0 = System.nanoTime();
181 <                assertFalse(Thread.currentThread().isInterrupted());
182 <                threadStarted.countDown();
183 <                do {
184 <                    LockSupport.parkUntil(d);
185 <                    // parkUntil may return spuriously
186 <                } while (! Thread.currentThread().isInterrupted());
187 <                assertTrue(System.nanoTime() - t0 < nanos);
188 <            }});
189 <
190 <        threadStarted.await();
191 <        delay(SHORT_DELAY_MS);
192 <        t.interrupt();
193 <        awaitTermination(t, MEDIUM_DELAY_MS);
160 >    public void testParkBeforeInterrupt_parkNanos() {
161 >        testParkBeforeInterrupt(ParkMethod.parkNanos);
162      }
163 <
164 <    /**
165 <     * parkNanos is released by subsequent interrupt
166 <     */
167 <    public void testParkNanosBeforeInterrupt() throws InterruptedException {
168 <        final CountDownLatch threadStarted = new CountDownLatch(1);
163 >    public void testParkBeforeInterrupt_parkUntil() {
164 >        testParkBeforeInterrupt(ParkMethod.parkUntil);
165 >    }
166 >    public void testParkBeforeInterrupt_parkBlocker() {
167 >        testParkBeforeInterrupt(ParkMethod.parkBlocker);
168 >    }
169 >    public void testParkBeforeInterrupt_parkNanosBlocker() {
170 >        testParkBeforeInterrupt(ParkMethod.parkNanosBlocker);
171 >    }
172 >    public void testParkBeforeInterrupt_parkUntilBlocker() {
173 >        testParkBeforeInterrupt(ParkMethod.parkUntilBlocker);
174 >    }
175 >    public void testParkBeforeInterrupt(final ParkMethod parkMethod) {
176 >        final CountDownLatch pleaseInterrupt = new CountDownLatch(1);
177          Thread t = newStartedThread(new CheckedRunnable() {
178              public void realRun() {
179 <                long nanos = LONG_DELAY_MS * 1000L * 1000L;
204 <                long t0 = System.nanoTime();
205 <                assertFalse(Thread.currentThread().isInterrupted());
206 <                threadStarted.countDown();
179 >                pleaseInterrupt.countDown();
180                  do {
181 <                    LockSupport.parkNanos(nanos);
182 <                    // parkNanos may return spuriously
181 >                    parkMethod.park();
182 >                    // park may return spuriously
183                  } while (! Thread.currentThread().isInterrupted());
211                assertTrue(System.nanoTime() - t0 < nanos);
184              }});
185  
186 <        threadStarted.await();
187 <        delay(SHORT_DELAY_MS);
186 >        await(pleaseInterrupt);
187 >        assertThreadStaysAlive(t);
188          t.interrupt();
189 <        awaitTermination(t, MEDIUM_DELAY_MS);
189 >        awaitTermination(t);
190      }
191  
192      /**
193       * park is released by preceding interrupt
194       */
195 <    public void testParkAfterInterrupt() throws Exception {
196 <        final CountDownLatch threadStarted = new CountDownLatch(1);
225 <        final AtomicBoolean unparked = new AtomicBoolean(false);
226 <        Thread t = newStartedThread(new CheckedRunnable() {
227 <            public void realRun() throws Exception {
228 <                threadStarted.countDown();
229 <                while (!unparked.get())
230 <                    Thread.yield();
231 <                assertTrue(Thread.currentThread().isInterrupted());
232 <                LockSupport.park();
233 <                assertTrue(Thread.currentThread().isInterrupted());
234 <            }});
235 <
236 <        threadStarted.await();
237 <        t.interrupt();
238 <        unparked.set(true);
239 <        awaitTermination(t, MEDIUM_DELAY_MS);
195 >    public void testParkAfterInterrupt_park() {
196 >        testParkAfterInterrupt(ParkMethod.park);
197      }
198 <
199 <    /**
243 <     * parkUntil is released by preceding interrupt
244 <     */
245 <    public void testParkUntilAfterInterrupt() throws Exception {
246 <        final CountDownLatch threadStarted = new CountDownLatch(1);
247 <        final AtomicBoolean unparked = new AtomicBoolean(false);
248 <        Thread t = newStartedThread(new CheckedRunnable() {
249 <            public void realRun() throws Exception {
250 <                threadStarted.countDown();
251 <                while (!unparked.get())
252 <                    Thread.yield();
253 <                long d = new Date().getTime() + LONG_DELAY_MS;
254 <                long nanos = LONG_DELAY_MS * 1000L * 1000L;
255 <                long t0 = System.nanoTime();
256 <                assertTrue(Thread.currentThread().isInterrupted());
257 <                LockSupport.parkUntil(d);
258 <                assertTrue(System.nanoTime() - t0 < nanos);
259 <                assertTrue(Thread.currentThread().isInterrupted());
260 <            }});
261 <
262 <        threadStarted.await();
263 <        t.interrupt();
264 <        unparked.set(true);
265 <        awaitTermination(t, MEDIUM_DELAY_MS);
198 >    public void testParkAfterInterrupt_parkNanos() {
199 >        testParkAfterInterrupt(ParkMethod.parkNanos);
200      }
201 <
202 <    /**
203 <     * parkNanos is released by preceding interrupt
204 <     */
205 <    public void testParkNanosAfterInterrupt() throws Exception {
206 <        final CountDownLatch threadStarted = new CountDownLatch(1);
207 <        final AtomicBoolean unparked = new AtomicBoolean(false);
201 >    public void testParkAfterInterrupt_parkUntil() {
202 >        testParkAfterInterrupt(ParkMethod.parkUntil);
203 >    }
204 >    public void testParkAfterInterrupt_parkBlocker() {
205 >        testParkAfterInterrupt(ParkMethod.parkBlocker);
206 >    }
207 >    public void testParkAfterInterrupt_parkNanosBlocker() {
208 >        testParkAfterInterrupt(ParkMethod.parkNanosBlocker);
209 >    }
210 >    public void testParkAfterInterrupt_parkUntilBlocker() {
211 >        testParkAfterInterrupt(ParkMethod.parkUntilBlocker);
212 >    }
213 >    public void testParkAfterInterrupt(final ParkMethod parkMethod) {
214 >        final CountDownLatch pleaseInterrupt = new CountDownLatch(1);
215 >        final AtomicBoolean pleasePark = new AtomicBoolean(false);
216          Thread t = newStartedThread(new CheckedRunnable() {
217              public void realRun() throws Exception {
218 <                threadStarted.countDown();
219 <                while (!unparked.get())
218 >                pleaseInterrupt.countDown();
219 >                while (!pleasePark.get())
220                      Thread.yield();
279                long nanos = LONG_DELAY_MS * 1000L * 1000L;
280                long t0 = System.nanoTime();
221                  assertTrue(Thread.currentThread().isInterrupted());
222 <                LockSupport.parkNanos(nanos);
283 <                assertTrue(System.nanoTime() - t0 < nanos);
222 >                parkMethod.park();
223                  assertTrue(Thread.currentThread().isInterrupted());
224              }});
225  
226 <        threadStarted.await();
226 >        await(pleaseInterrupt);
227          t.interrupt();
228 <        unparked.set(true);
229 <        awaitTermination(t, MEDIUM_DELAY_MS);
228 >        pleasePark.set(true);
229 >        awaitTermination(t);
230      }
231  
232      /**
233 <     * parkNanos times out if not unparked
233 >     * timed park times out if not unparked
234       */
235 <    public void testParkNanosTimesOut() throws InterruptedException {
236 <        Thread t = newStartedThread(new CheckedRunnable() {
298 <            public void realRun() {
299 <                for (;;) {
300 <                    long timeoutNanos = SHORT_DELAY_MS * 1000L * 1000L;
301 <                    long t0 = System.nanoTime();
302 <                    LockSupport.parkNanos(timeoutNanos);
303 <                    // parkNanos may return spuriously
304 <                    if (System.nanoTime() - t0 >= timeoutNanos)
305 <                        return;
306 <                }
307 <            }});
308 <
309 <        awaitTermination(t, MEDIUM_DELAY_MS);
235 >    public void testParkTimesOut_parkNanos() {
236 >        testParkTimesOut(ParkMethod.parkNanos);
237      }
238 <
239 <    /**
240 <     * parkUntil times out if not unparked
241 <     */
242 <    public void testParkUntilTimesOut() throws InterruptedException {
238 >    public void testParkTimesOut_parkUntil() {
239 >        testParkTimesOut(ParkMethod.parkUntil);
240 >    }
241 >    public void testParkTimesOut_parkNanosBlocker() {
242 >        testParkTimesOut(ParkMethod.parkNanosBlocker);
243 >    }
244 >    public void testParkTimesOut_parkUntilBlocker() {
245 >        testParkTimesOut(ParkMethod.parkUntilBlocker);
246 >    }
247 >    public void testParkTimesOut(final ParkMethod parkMethod) {
248          Thread t = newStartedThread(new CheckedRunnable() {
249              public void realRun() {
250                  for (;;) {
251 <                    long d = new Date().getTime() + SHORT_DELAY_MS;
252 <                    // beware of rounding
253 <                    long timeoutNanos = (SHORT_DELAY_MS - 1) * 1000L * 1000L;
254 <                    long t0 = System.nanoTime();
323 <                    LockSupport.parkUntil(d);
324 <                    // parkUntil may return spuriously
325 <                    if (System.nanoTime() - t0 >= timeoutNanos)
251 >                    long startTime = System.nanoTime();
252 >                    parkMethod.park(timeoutMillis());
253 >                    // park may return spuriously
254 >                    if (millisElapsedSince(startTime) >= timeoutMillis())
255                          return;
256                  }
257              }});
258  
259 <        awaitTermination(t, MEDIUM_DELAY_MS);
259 >        awaitTermination(t);
260      }
261  
262      /**
# Line 341 | Line 270 | public class LockSupportTest extends JSR
270      }
271  
272      /**
273 <     * parkUntil(0) returns immediately.
273 >     * getBlocker returns the blocker object passed to park
274 >     */
275 >    public void testGetBlocker_parkBlocker() {
276 >        testGetBlocker(ParkMethod.parkBlocker);
277 >    }
278 >    public void testGetBlocker_parkNanosBlocker() {
279 >        testGetBlocker(ParkMethod.parkNanosBlocker);
280 >    }
281 >    public void testGetBlocker_parkUntilBlocker() {
282 >        testGetBlocker(ParkMethod.parkUntilBlocker);
283 >    }
284 >    public void testGetBlocker(final ParkMethod parkMethod) {
285 >        final CountDownLatch started = new CountDownLatch(1);
286 >        Thread t = newStartedThread(new CheckedRunnable() {
287 >            public void realRun() {
288 >                Thread t = Thread.currentThread();
289 >                started.countDown();
290 >                do {
291 >                    assertNull(LockSupport.getBlocker(t));
292 >                    parkMethod.park();
293 >                    assertNull(LockSupport.getBlocker(t));
294 >                    // park may return spuriously
295 >                } while (! Thread.currentThread().isInterrupted());
296 >            }});
297 >
298 >        long startTime = System.nanoTime();
299 >        await(started);
300 >        for (;;) {
301 >            Object x = LockSupport.getBlocker(t);
302 >            if (x == theBlocker()) { // success
303 >                t.interrupt();
304 >                awaitTermination(t);
305 >                assertNull(LockSupport.getBlocker(t));
306 >                return;
307 >            } else {
308 >                assertNull(x);  // ok
309 >                if (millisElapsedSince(startTime) > LONG_DELAY_MS)
310 >                    fail("timed out");
311 >                Thread.yield();
312 >            }
313 >        }
314 >    }
315 >
316 >    /**
317 >     * timed park(0) returns immediately.
318       *
319       * Requires hotspot fix for:
320       * 6763959 java.util.concurrent.locks.LockSupport.parkUntil(0) blocks forever
321       * which is in jdk7-b118 and 6u25.
322       */
323 <    public void testParkUntil0Returns() throws InterruptedException {
323 >    public void testPark0_parkNanos() {
324 >        testPark0(ParkMethod.parkNanos);
325 >    }
326 >    public void testPark0_parkUntil() {
327 >        testPark0(ParkMethod.parkUntil);
328 >    }
329 >    public void testPark0_parkNanosBlocker() {
330 >        testPark0(ParkMethod.parkNanosBlocker);
331 >    }
332 >    public void testPark0_parkUntilBlocker() {
333 >        testPark0(ParkMethod.parkUntilBlocker);
334 >    }
335 >    public void testPark0(final ParkMethod parkMethod) {
336 >        Thread t = newStartedThread(new CheckedRunnable() {
337 >            public void realRun() {
338 >                parkMethod.park(0L);
339 >            }});
340 >
341 >        awaitTermination(t);
342 >    }
343 >
344 >    /**
345 >     * timed park(Long.MIN_VALUE) returns immediately.
346 >     */
347 >    public void testParkNeg_parkNanos() {
348 >        testParkNeg(ParkMethod.parkNanos);
349 >    }
350 >    public void testParkNeg_parkUntil() {
351 >        testParkNeg(ParkMethod.parkUntil);
352 >    }
353 >    public void testParkNeg_parkNanosBlocker() {
354 >        testParkNeg(ParkMethod.parkNanosBlocker);
355 >    }
356 >    public void testParkNeg_parkUntilBlocker() {
357 >        testParkNeg(ParkMethod.parkUntilBlocker);
358 >    }
359 >    public void testParkNeg(final ParkMethod parkMethod) {
360          Thread t = newStartedThread(new CheckedRunnable() {
361              public void realRun() {
362 <                LockSupport.parkUntil(0L);
362 >                parkMethod.park(Long.MIN_VALUE);
363              }});
364  
365          awaitTermination(t);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines