Here you can find the source of countWorkerPoolTimerThreads()
public static int countWorkerPoolTimerThreads()
//package com.java2s; //License from project: Open Source License public class Main { private static final String WORKER_POOL_TIMER = "java.util.TimerThread"; public static int countWorkerPoolTimerThreads() { return countThreads(WORKER_POOL_TIMER); }//from w ww . j a v a 2 s.co m private static int countThreads(String namePattern) { Thread[] list = new Thread[100]; Thread.enumerate(list); int matches = 0; for (Thread element : list) { if (element != null) { if (element.getName().matches(namePattern) || element.getClass().getName().matches(namePattern)) { matches++; } } } return matches; } }