use of com.exactprosystems.clearth.utils.ThreadDumpGenerator in project clearth by exactpro.
the class LogsBean method getThreadDumps.
// *** Thread dumps routines ***
public StreamedContent getThreadDumps() {
if (!logsDir.exists())
return null;
try {
if (!outputDir.exists())
outputDir.mkdir();
ThreadDumpGenerator threadDumpGenerator = new ThreadDumpGenerator();
File result = threadDumpGenerator.writeThreadDump(outputDir, UserInfoUtils.getUserName() + "_thread_dump.txt");
result.deleteOnExit();
return new DefaultStreamedContent(new FileInputStream(result), new MimetypesFileTypeMap().getContentType(result), "thread_dump.txt");
} catch (Exception e) {
String msg = "Could not generate thread dumps";
getLogger().error(msg, e);
MessageUtils.addErrorMessage(msg, ExceptionUtils.getDetailedMessage(e));
return null;
}
}
Aggregations