提交 5211451d 编写于 作者: K kshefov

8129532: LFMultiThreadCachingTest.java failed with ConcurrentModificationException

Reviewed-by: vlivanov
上级 0e090c4f
...@@ -79,23 +79,18 @@ public final class LFMultiThreadCachingTest extends LFCachingTestCase { ...@@ -79,23 +79,18 @@ public final class LFMultiThreadCachingTest extends LFCachingTestCase {
CountDownLatch end = new CountDownLatch(CORES); CountDownLatch end = new CountDownLatch(CORES);
final Map<Thread, Throwable> threadUncaughtExceptions final Map<Thread, Throwable> threadUncaughtExceptions
= Collections.synchronizedMap(new HashMap<Thread, Throwable>(CORES)); = Collections.synchronizedMap(new HashMap<Thread, Throwable>(CORES));
Thread.UncaughtExceptionHandler exHandler = (t, e) -> {
threadUncaughtExceptions.put(t, e);
};
for (int i = 0; i < CORES; ++i) { for (int i = 0; i < CORES; ++i) {
TestMethods.Kind kind = KINDS[i % KINDS.length]; TestMethods.Kind kind = KINDS[i % KINDS.length];
Thread t = new Thread(() -> { Thread t = new Thread(() -> {
try { try {
begin.await(); begin.await();
adapters.add(getTestMethod().getTestCaseMH(data, kind)); adapters.add(getTestMethod().getTestCaseMH(data, kind));
} catch (InterruptedException | BrokenBarrierException } catch (Throwable ex) {
| IllegalAccessException | NoSuchMethodException ex) { threadUncaughtExceptions.put(Thread.currentThread(), ex);
throw new Error("Unexpected exception", ex);
} finally { } finally {
end.countDown(); end.countDown();
} }
}); });
t.setUncaughtExceptionHandler(exHandler);
t.start(); t.start();
} }
try { try {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册