in src/main/scala/com/twitter/iago/server/ParrotServer.scala [185:211]
def listThreads(group: ThreadGroup, container: Node): Node = {
val result = <g name={group.getName} class={group.getClass.toString}/>
val threads = new Array[Thread](group.activeCount * 2 + 10)
val nt = group.enumerate(threads, false)
var threadNodes = mutable.ListBuffer[Elem]()
for (i <- 0 until nt) {
val t = threads(i)
var methods = mutable.ListBuffer[Elem]()
t.getStackTrace foreach { e =>
methods += <method>
{e}
</method>
}
threadNodes += <foo name={t.getName} class={t.getClass.toString}>
{methods}
</foo>
}
var ng = group.activeGroupCount
val groups = new Array[ThreadGroup](ng * 2 + 10)
ng = group.enumerate(groups, false)
for (i <- 0 until ng) {
listThreads(groups(i), result)
}
<g name={group.getName} class={group.getClass.toString}>
{result}
</g>
}