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.99 by jsr166, Tue Feb 5 03:39:34 2013 UTC vs.
Revision 1.105 by dl, Thu Mar 21 19:06:54 2013 UTC

# Line 286 | Line 286 | public class JSR166TestCase extends Test
286          // Java8+ test classes
287          if (atLeastJava8()) {
288              String[] java8TestClassNames = {
289 <                "StampedLockTest",
289 >                "CompletableFutureTest",
290 >                "ConcurrentHashMap8Test",
291 >                "CountedCompleterTest",
292 >                "DoubleAccumulatorTest",
293 >                "DoubleAdderTest",
294                  "ForkJoinPool8Test",
295 +                "LongAccumulatorTest",
296 +                "LongAdderTest",
297 +                "StampedLockTest",
298              };
299              addNamedTestClasses(suite, java8TestClassNames);
300          }
# Line 384 | Line 391 | public class JSR166TestCase extends Test
391  
392          if (Thread.interrupted())
393              throw new AssertionFailedError("interrupt status set in main thread");
394 +
395 +        checkForkJoinPoolThreadLeaks();
396 +    }
397 +
398 +    /**
399 +     * Find missing try { ... } finally { joinPool(e); }
400 +     */
401 +    void checkForkJoinPoolThreadLeaks() throws InterruptedException {
402 +        Thread[] survivors = new Thread[5];
403 +        int count = Thread.enumerate(survivors);
404 +        for (int i = 0; i < count; i++) {
405 +            Thread thread = survivors[i];
406 +            String name = thread.getName();
407 +            if (name.startsWith("ForkJoinPool-")) {
408 +                // give thread some time to terminate
409 +                thread.join(LONG_DELAY_MS);
410 +                if (!thread.isAlive()) continue;
411 +                thread.stop();
412 +                throw new AssertionFailedError
413 +                    (String.format("Found leaked ForkJoinPool thread test=%s thread=%s%n",
414 +                                   toString(), name));
415 +            }
416 +        }
417      }
418  
419      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines