All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.emc.mongoose.api.model.concurrent.ThreadDump Maven / Gradle / Ivy

There is a newer version: 4.0.0-alpha5
Show newest version
package com.emc.mongoose.api.model.concurrent;

import java.util.Map;

/**
 Created by andrey on 08.08.17.
 */
public final class ThreadDump {

	private final Map threadDumpData = Thread.getAllStackTraces();

	@Override
	public final String toString() {
		final StringBuilder threadDumpStr = new StringBuilder();
		final String lineSep = System.lineSeparator();
		for(final Thread thread : threadDumpData.keySet()) {
			threadDumpStr
				.append(thread.getName())
				.append(" (state: ")
				.append(thread.getState())
				.append("):")
				.append(lineSep);
			final StackTraceElement[] threadStackTrace = threadDumpData.get(thread);
			for(final StackTraceElement ste : threadStackTrace) {
				threadDumpStr
					.append('\t')
					.append(ste)
					.append(lineSep);
			}
		}
		return threadDumpStr.toString();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy