/** * This method checks if a thread should be processed by thread cleaning features. * * @param thread * The thread to check * @param threadSnapshot * Threads recorded by a thread snapshot are ignored by this method. * @param noProcessThreads * The threads to be ignored. * @return Returns <code>true</code> if the thread should be processed by thread cleaning features or * <code>false</code> if the thread should not be processed either because it is a JVM system thread or the * thread is contained by the <tt>noProcessThreads</tt> list. */ public static boolean processThread(Thread thread, ThreadSnapshot threadSnapshot, List<Thread> noProcessThreads) { // schuettec - 25.04.2017 : Ignore Daemon Threads because they will terminate if no other thread lives if (thread.isDaemon()) { return false; } ThreadGroup threadGroup = thread.getThreadGroup(); // Filter the shutdown thread and other java system threads if (noProcessThreads.contains(thread) || thread.getName() .equals("DestroyJavaVM") || (threadGroup != null && STATIC_THREADGROUP_FILTER.contains(threadGroup.getName())) || isStaticFilteredThreadName(thread.getName())) { return false; } else if (threadSnapshot != null && threadSnapshot.contains(thread)) { return false; } else { return true; } }