8129532: LFMultiThreadCachingTest.java failed with ConcurrentModificationException
authorkshefov
Tue, 23 Jun 2015 16:36:04 +0300
changeset 31251 f13b582c8179
parent 31250 d23d7f1b8674
child 31252 b495f68ca12c
child 31256 d4e947de3045
8129532: LFMultiThreadCachingTest.java failed with ConcurrentModificationException Reviewed-by: vlivanov
jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java
--- a/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java	Tue Jun 23 09:23:53 2015 -0400
+++ b/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java	Tue Jun 23 16:36:04 2015 +0300
@@ -80,23 +80,18 @@
         CountDownLatch end = new CountDownLatch(CORES);
         final Map<Thread, Throwable> threadUncaughtExceptions
                 = Collections.synchronizedMap(new HashMap<Thread, Throwable>(CORES));
-        Thread.UncaughtExceptionHandler exHandler = (t, e) -> {
-            threadUncaughtExceptions.put(t, e);
-        };
         for (int i = 0; i < CORES; ++i) {
             TestMethods.Kind kind = KINDS[i % KINDS.length];
             Thread t = new Thread(() -> {
                 try {
                     begin.await();
                     adapters.add(getTestMethod().getTestCaseMH(data, kind));
-                } catch (InterruptedException | BrokenBarrierException
-                        | IllegalAccessException | NoSuchMethodException ex) {
-                    throw new Error("Unexpected exception", ex);
+                } catch (Throwable ex) {
+                    threadUncaughtExceptions.put(Thread.currentThread(), ex);
                 } finally {
                     end.countDown();
                 }
             });
-            t.setUncaughtExceptionHandler(exHandler);
             t.start();
         }
         try {