mirror of
https://github.com/jlengrand/vert.x.git
synced 2026-03-10 08:51:19 +00:00
Revert "Detect and print deadlocks in JVM when blocked thread checker detects a blocked thread"
This reverts commit 8580977000.
This commit is contained in:
@@ -15,9 +15,6 @@ import io.vertx.core.VertxException;
|
||||
import io.vertx.core.impl.logging.Logger;
|
||||
import io.vertx.core.impl.logging.LoggerFactory;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.management.ThreadInfo;
|
||||
import java.lang.management.ThreadMXBean;
|
||||
import java.util.Map;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
@@ -29,8 +26,6 @@ import java.util.concurrent.TimeUnit;
|
||||
*/
|
||||
public class BlockedThreadChecker {
|
||||
|
||||
private final ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
|
||||
|
||||
/**
|
||||
* A checked task.
|
||||
*/
|
||||
@@ -63,14 +58,6 @@ public class BlockedThreadChecker {
|
||||
if (warningExceptionTimeUnit.convert(dur, TimeUnit.NANOSECONDS) <= warningExceptionTime) {
|
||||
log.warn(message);
|
||||
} else {
|
||||
|
||||
// Check for deadlocks
|
||||
long[] deadlockedThreadIds = mbean.findDeadlockedThreads();
|
||||
if (deadlockedThreadIds != null) {
|
||||
ThreadInfo[] threadInfos = mbean.getThreadInfo(deadlockedThreadIds);
|
||||
handleDeadlock(threadInfos);
|
||||
}
|
||||
|
||||
VertxException stackTrace = new VertxException("Thread blocked");
|
||||
stackTrace.setStackTrace(entry.getKey().getStackTrace());
|
||||
log.warn(message, stackTrace);
|
||||
@@ -82,24 +69,6 @@ public class BlockedThreadChecker {
|
||||
}, intervalUnit.toMillis(interval), intervalUnit.toMillis(interval));
|
||||
}
|
||||
|
||||
private void handleDeadlock(final ThreadInfo[] deadlockedThreads) {
|
||||
System.err.println("Deadlock detected!");
|
||||
Map<Thread, StackTraceElement[]> stackTraceMap = Thread.getAllStackTraces();
|
||||
for (ThreadInfo threadInfo : deadlockedThreads) {
|
||||
if (threadInfo != null) {
|
||||
for (Thread thread : Thread.getAllStackTraces().keySet()) {
|
||||
if (thread.getId() == threadInfo.getThreadId()) {
|
||||
System.err.println(threadInfo.toString().trim());
|
||||
for (StackTraceElement ste : thread.getStackTrace()) {
|
||||
System.err.println("\t" + ste.toString().trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
synchronized void registerThread(Thread thread, Task checked) {
|
||||
threads.put(thread, checked);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user