List of usage examples for java.lang Thread toString
public String toString()
From source file:org.jgap.Configuration.java
/** * Builds a string considering the current thread and the given id. * * @param current the current Thread//from w ww. ja v a2s. c o m * @param a_id a hopefully unique id of the configuration * * @return string built up * * @author Klaus Meffert * @since 3.01 */ protected static String getThreadKey(Thread current, String a_id) { return current.toString() + "|" + a_id + "|"; }
From source file:org.opencb.opencga.storage.core.variant.VariantStorageBaseTest.java
public void printActiveThreads() { System.out.println("========================================="); System.out.println("Thread.activeCount() = " + Thread.activeCount()); Map<Thread, StackTraceElement[]> allStackTraces = Thread.getAllStackTraces(); Set<String> groups = allStackTraces.keySet().stream() .filter(t -> t.getThreadGroup() == null || !t.getThreadGroup().getName().equals("system")) .map(t -> String.valueOf(t.getThreadGroup())).collect(Collectors.toSet()); for (String group : groups) { System.out.println("group = " + group); for (Map.Entry<Thread, StackTraceElement[]> entry : allStackTraces.entrySet()) { Thread thread = entry.getKey(); if (String.valueOf(thread.getThreadGroup()).equals(group)) { System.out.println("\t[" + thread.getId() + "] " + thread.toString() + ":" + thread.getState()); }/*from w w w . j a v a2s .c o m*/ } } System.out.println("========================================="); }
From source file:org.waarp.commandexec.server.LocalExecServerHandler.java
/** * Print stack trace//from w ww .j a va 2 s . c om * * @param thread * @param stacks */ static private void printStackTrace(Thread thread, StackTraceElement[] stacks) { System.err.print(thread.toString() + " : "); for (int i = 0; i < stacks.length - 1; i++) { System.err.print(stacks[i].toString() + " "); } System.err.println(stacks[stacks.length - 1].toString()); }