Java examples for java.lang:Thread
Get root thread group
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { System.out.println(getRootThreadGroup()); }/*from w w w. java 2 s . com*/ /** * Get root thread group * * @return root thread group */ private static ThreadGroup getRootThreadGroup() { ThreadGroup root = Thread.currentThread().getThreadGroup(); ThreadGroup parent = root.getParent(); while (parent != null) { root = parent; parent = parent.getParent(); } return root; } }