From c05bfbd3bdd42210b93e86376fecbc83136f3301 Mon Sep 17 00:00:00 2001 From: mindless Date: Mon, 15 Mar 2010 20:18:24 +0000 Subject: [PATCH] [HUDSON-1520] fix compile error from r28632 and make remote call sort by ThreadGroup too git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@28643 71c3de6d-444a-0410-be80-ed276b4c234a --- .../main/java/hudson/util/RemotingDiagnostics.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/hudson/util/RemotingDiagnostics.java b/core/src/main/java/hudson/util/RemotingDiagnostics.java index ee08c29c34..5fce31ab78 100644 --- a/core/src/main/java/hudson/util/RemotingDiagnostics.java +++ b/core/src/main/java/hudson/util/RemotingDiagnostics.java @@ -1,7 +1,7 @@ /* * The MIT License * - * Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi + * Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -72,13 +72,15 @@ public final class RemotingDiagnostics { public Map call() { Map r = new LinkedHashMap(); try { - for (ThreadInfo ti : Functions.getThreadInfos()) - r.put(ti.getThreadName(),Functions.dumpThreadInfo(ti)); + ThreadInfo[] data = Functions.getThreadInfos(); + Functions.ThreadGroupMap map = Functions.sortThreadsAndGetGroupMap(data); + for (ThreadInfo ti : data) + r.put(ti.getThreadName(),Functions.dumpThreadInfo(ti,map)); } catch (LinkageError _) { // not in JDK6. fall back to JDK5 r.clear(); - for (Map.Entry t : Thread.getAllStackTraces().entrySet()) { - StringBuffer buf = new StringBuffer(); + for (Map.Entry t : Functions.dumpAllThreads().entrySet()) { + StringBuilder buf = new StringBuilder(); for (StackTraceElement e : t.getValue()) buf.append(e).append('\n'); r.put(t.getKey().getName(),buf.toString());