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

Comparing jsr166/src/test/tck/JSR166TestCase.java (file contents):
Revision 1.72 by jsr166, Sun Nov 28 08:43:53 2010 UTC vs.
Revision 1.75 by jsr166, Tue May 3 06:08:49 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 631 | Line 631 | public class JSR166TestCase extends Test
631      }
632  
633      /**
634 +     * Waits up to LONG_DELAY_MS for the given thread to enter a wait
635 +     * state: BLOCKED, WAITING, or TIMED_WAITING.
636 +     */
637 +    void waitForThreadToEnterWaitState(Thread thread) {
638 +        waitForThreadToEnterWaitState(thread, LONG_DELAY_MS);
639 +    }
640 +
641 +    /**
642       * Returns the number of milliseconds since time given by
643       * startNanoTime, which must have been previously returned from a
644       * call to {@link System.nanoTime()}.
# Line 667 | Line 675 | public class JSR166TestCase extends Test
675          }
676      }
677  
678 +    /**
679 +     * Waits for LONG_DELAY_MS milliseconds for the thread to
680 +     * terminate (using {@link Thread#join(long)}), else interrupts
681 +     * the thread (in the hope that it may terminate later) and fails.
682 +     */
683 +    void awaitTermination(Thread t) {
684 +        awaitTermination(t, LONG_DELAY_MS);
685 +    }
686 +
687      // Some convenient Runnable classes
688  
689      public abstract class CheckedRunnable implements Runnable {
# Line 789 | Line 806 | public class JSR166TestCase extends Test
806              }};
807      }
808  
809 +    public Runnable awaiter(final CountDownLatch latch) {
810 +        return new CheckedRunnable() {
811 +            public void realRun() throws InterruptedException {
812 +                latch.await();
813 +            }};
814 +    }
815 +
816      public static class NPETask implements Callable<String> {
817          public String call() { throw new NullPointerException(); }
818      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines