提交 f1014595 authored 作者: Thomas Mueller's avatar Thomas Mueller

Java 8 compatibility for tests

上级 ab1c98ae
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
*/ */
package org.h2.test.utils; package org.h2.test.utils;
import java.lang.reflect.Method;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.Map; import java.util.Map;
...@@ -75,13 +74,9 @@ public class SelfDestructor { ...@@ -75,13 +74,9 @@ public class SelfDestructor {
int activeCount = Thread.activeCount(); int activeCount = Thread.activeCount();
Thread[] threads = new Thread[activeCount + 100]; Thread[] threads = new Thread[activeCount + 100];
int len = Thread.enumerate(threads); int len = Thread.enumerate(threads);
Method stop = Thread.class.getMethod("stop", Throwable.class);
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
Thread t = threads[i]; Thread t = threads[i];
String threadName = "Thread #" + i + ": " + t.getName();
Error e = new Error(threadName);
if (t != Thread.currentThread()) { if (t != Thread.currentThread()) {
stop.invoke(t, e);
t.interrupt(); t.interrupt();
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论