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

Comparing jsr166/src/test/tck/SynchronousQueueTest.java (file contents):
Revision 1.29 by jsr166, Thu Nov 18 20:18:43 2010 UTC vs.
Revision 1.33 by dl, Fri May 6 11:22:07 2011 UTC

# Line 1 | Line 1
1   /*
2   * Written by Doug Lea with assistance from members of JCP JSR-166
3   * Expert Group and released to the public domain, as explained at
4 < * http://creativecommons.org/licenses/publicdomain
4 > * http://creativecommons.org/publicdomain/zero/1.0/
5   * Other contributors include Andrew Wright, Jeffrey Hayes,
6   * Pat Fisher, Mike Judd.
7   */
# Line 159 | Line 159 | public class SynchronousQueueTest extend
159              q.put(null);
160              shouldThrow();
161          } catch (NullPointerException success) {}
162 <     }
162 >    }
163  
164      /**
165       * put blocks interruptibly if no active taker
# Line 172 | Line 172 | public class SynchronousQueueTest extend
172              }});
173  
174          t.start();
175 <        Thread.sleep(SHORT_DELAY_MS);
175 >        delay(SHORT_DELAY_MS);
176          t.interrupt();
177          t.join();
178      }
# Line 196 | Line 196 | public class SynchronousQueueTest extend
196              }});
197  
198          t.start();
199 <        Thread.sleep(SHORT_DELAY_MS);
199 >        delay(SHORT_DELAY_MS);
200          assertEquals(0, q.take());
201 <        Thread.sleep(SHORT_DELAY_MS);
201 >        delay(SHORT_DELAY_MS);
202          t.interrupt();
203          t.join();
204      }
# Line 253 | Line 253 | public class SynchronousQueueTest extend
253              }});
254  
255          t.start();
256 <        Thread.sleep(SHORT_DELAY_MS);
256 >        delay(SHORT_DELAY_MS);
257          t.interrupt();
258          t.join();
259      }
# Line 277 | Line 277 | public class SynchronousQueueTest extend
277              }});
278  
279          t.start();
280 <        Thread.sleep(SHORT_DELAY_MS);
280 >        delay(SHORT_DELAY_MS);
281          assertEquals(0, q.take());
282 <        Thread.sleep(SHORT_DELAY_MS);
282 >        delay(SHORT_DELAY_MS);
283          t.interrupt();
284          t.join();
285      }
# Line 295 | Line 295 | public class SynchronousQueueTest extend
295              }});
296  
297          t.start();
298 <        Thread.sleep(SHORT_DELAY_MS);
298 >        delay(SHORT_DELAY_MS);
299          t.interrupt();
300          t.join();
301      }
# Line 346 | Line 346 | public class SynchronousQueueTest extend
346              }});
347  
348          threadStarted.await();
349 <        Thread.sleep(SHORT_DELAY_MS);
349 >        delay(SHORT_DELAY_MS);
350          t.interrupt();
351          awaitTermination(t, MEDIUM_DELAY_MS);
352      }
# Line 397 | Line 397 | public class SynchronousQueueTest extend
397          long t0 = System.nanoTime();
398          assertTrue(q.offer(zero, LONG_DELAY_MS, MILLISECONDS));
399          assertTrue(millisElapsedSince(t0) < MEDIUM_DELAY_MS);
400 <        
400 >
401          t.interrupt();
402          awaitTermination(t, MEDIUM_DELAY_MS);
403      }
# Line 573 | Line 573 | public class SynchronousQueueTest extend
573  
574          executor.execute(new CheckedRunnable() {
575              public void realRun() throws InterruptedException {
576 <                Thread.sleep(SMALL_DELAY_MS);
576 >                delay(SMALL_DELAY_MS);
577                  assertSame(one, q.take());
578              }});
579  
# Line 595 | Line 595 | public class SynchronousQueueTest extend
595  
596          executor.execute(new CheckedRunnable() {
597              public void realRun() throws InterruptedException {
598 <                Thread.sleep(SHORT_DELAY_MS);
598 >                delay(SHORT_DELAY_MS);
599                  q.put(one);
600              }});
601  
# Line 665 | Line 665 | public class SynchronousQueueTest extend
665  
666          t.start();
667          ArrayList l = new ArrayList();
668 <        Thread.sleep(SHORT_DELAY_MS);
668 >        delay(SHORT_DELAY_MS);
669          q.drainTo(l);
670          assertTrue(l.size() <= 1);
671          if (l.size() > 0)
# Line 714 | Line 714 | public class SynchronousQueueTest extend
714          t1.start();
715          t2.start();
716          ArrayList l = new ArrayList();
717 <        Thread.sleep(SHORT_DELAY_MS);
717 >        delay(SHORT_DELAY_MS);
718          q.drainTo(l, 1);
719          assertEquals(1, l.size());
720          q.drainTo(l, 1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines