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.192 by jsr166, Sun May 22 01:09:21 2016 UTC vs.
Revision 1.197 by jsr166, Wed Jun 22 14:40:36 2016 UTC

# Line 12 | Line 12
12   * @modules java.management
13   * @build *
14   * @run junit/othervm/timeout=1000 -Djsr166.testImplementationDetails=true JSR166TestCase
15 + * @run junit/othervm/timeout=1000 -Djava.util.concurrent.ForkJoinPool.common.parallelism=0 -Djsr166.testImplementationDetails=true JSR166TestCase
16   */
17  
18   import static java.util.concurrent.TimeUnit.MILLISECONDS;
# Line 58 | Line 59 | import java.util.concurrent.RecursiveAct
59   import java.util.concurrent.RecursiveTask;
60   import java.util.concurrent.RejectedExecutionHandler;
61   import java.util.concurrent.Semaphore;
62 + import java.util.concurrent.SynchronousQueue;
63   import java.util.concurrent.ThreadFactory;
64   import java.util.concurrent.ThreadPoolExecutor;
65   import java.util.concurrent.TimeoutException;
# Line 519 | Line 521 | public class JSR166TestCase extends Test
521          // Java9+ test classes
522          if (atLeastJava9()) {
523              String[] java9TestClassNames = {
524 +                "AtomicBoolean9Test",
525 +                "AtomicInteger9Test",
526 +                "AtomicIntegerArray9Test",
527 +                "AtomicLong9Test",
528 +                "AtomicLongArray9Test",
529 +                "AtomicReference9Test",
530 +                "AtomicReferenceArray9Test",
531                  "ExecutorCompletionService9Test",
532              };
533              addNamedTestClasses(suite, java9TestClassNames);
# Line 946 | Line 955 | public class JSR166TestCase extends Test
955          }
956      }
957  
958 <    /** Like Runnable, but with the freedom to throw anything */
958 >    /**
959 >     * Like Runnable, but with the freedom to throw anything.
960 >     * junit folks had the same idea:
961 >     * http://junit.org/junit5/docs/snapshot/api/org/junit/gen5/api/Executable.html
962 >     */
963      interface Action { public void run() throws Throwable; }
964  
965      /**
# Line 977 | Line 990 | public class JSR166TestCase extends Test
990       * Uninteresting threads are filtered out.
991       */
992      static void dumpTestThreads() {
993 +        SecurityManager sm = System.getSecurityManager();
994 +        if (sm != null) {
995 +            try {
996 +                System.setSecurityManager(null);
997 +            } catch (SecurityException giveUp) {
998 +                return;
999 +            }
1000 +        }
1001 +
1002          ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
1003          System.err.println("------ stacktrace dump start ------");
1004          for (ThreadInfo info : threadMXBean.dumpAllThreads(true, true)) {
# Line 994 | Line 1016 | public class JSR166TestCase extends Test
1016              System.err.print(info);
1017          }
1018          System.err.println("------ stacktrace dump end ------");
1019 +
1020 +        if (sm != null) System.setSecurityManager(sm);
1021      }
1022  
1023      /**
# Line 1841 | Line 1865 | public class JSR166TestCase extends Test
1865      public Runnable runnableThrowing(final RuntimeException ex) {
1866          return new Runnable() { public void run() { throw ex; }};
1867      }
1868 +
1869 +    /** A reusable thread pool to be shared by tests. */
1870 +    static final ExecutorService cachedThreadPool =
1871 +        new ThreadPoolExecutor(0, Integer.MAX_VALUE,
1872 +                               1000L, MILLISECONDS,
1873 +                               new SynchronousQueue<Runnable>());
1874 +
1875   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines