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

Comparing jsr166/src/test/tck/ForkJoinPoolTest.java (file contents):
Revision 1.64 by jsr166, Mon Oct 5 22:54:45 2015 UTC vs.
Revision 1.65 by jsr166, Tue Oct 6 21:22:54 2015 UTC

# Line 256 | Line 256 | public class ForkJoinPoolTest extends JS
256       */
257      public void testSetUncaughtExceptionHandler() throws InterruptedException {
258          final CountDownLatch uehInvoked = new CountDownLatch(1);
259 <        final Thread.UncaughtExceptionHandler eh =
259 >        final Thread.UncaughtExceptionHandler ueh =
260              new Thread.UncaughtExceptionHandler() {
261                  public void uncaughtException(Thread t, Throwable e) {
262                      uehInvoked.countDown();
263                  }};
264          ForkJoinPool p = new ForkJoinPool(1, new FailingThreadFactory(),
265 <                                          eh, false);
266 <        try {
267 <            assertSame(eh, p.getUncaughtExceptionHandler());
265 >                                          ueh, false);
266 >        try (PoolCleaner cleaner = cleaner(p)) {
267 >            assertSame(ueh, p.getUncaughtExceptionHandler());
268              try {
269 <                p.execute(new FibTask(8));
270 <                assertTrue(uehInvoked.await(MEDIUM_DELAY_MS, MILLISECONDS));
271 <            } catch (RejectedExecutionException ok) {
269 >                try {
270 >                    p.execute(new FibTask(8));
271 >                    await(uehInvoked);
272 >                } catch (RejectedExecutionException ok) {}
273 >            } finally {
274 >                p.shutdownNow(); // failure might have prevented processing task
275              }
273        } finally {
274            p.shutdownNow(); // failure might have prevented processing task
275            joinPool(p);
276          }
277      }
278  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines