Java tutorial
//package com.java2s; public class Main { public static ThreadGroup getRootThreadGroup() { ThreadGroup rootThreadGroup = Thread.currentThread().getThreadGroup(); ThreadGroup parent; while ((parent = rootThreadGroup.getParent()) != null) { rootThreadGroup = parent; } return rootThreadGroup; } }