Add log messages when dump starts

.. to make it easier to find the right dump file for a test when there
are multiple dump files.
This commit is contained in:
Trustin Lee 2014-12-12 11:54:14 +09:00
parent e72b2235fb
commit 6ee069ffb4

View File

@ -219,7 +219,7 @@ public final class TestUtils {
}
dumpHeap(heapDumpFile);
dumpStack(threadDumpFile);
dumpThreads(threadDumpFile);
}
private static String timestamp() {
@ -233,6 +233,7 @@ public final class TestUtils {
}
final String filename = file.toString();
logger.info("Dumping heap: {}", filename);
try {
hotspotMXBeanDumpHeap.invoke(hotspotMXBean, filename, true);
} catch (Exception e) {
@ -240,10 +241,11 @@ public final class TestUtils {
}
}
private static void dumpStack(File file) {
private static void dumpThreads(File file) {
final String filename = file.toString();
OutputStream out = null;
try {
logger.info("Dumping threads: {}", filename);
final StringBuilder buf = new StringBuilder(8192);
try {
for (ThreadInfo info : ManagementFactory.getThreadMXBean().dumpAllThreads(true, true)) {