* @return an EnumMap with Thread states as the key and the number of threads in that state as the value
*/
public EnumMap<Thread.State, AtomicInteger> getThreadStates() {
EnumMap<Thread.State, AtomicInteger> map = new EnumMap<State, AtomicInteger>(Thread.State.class);
for(ThreadInfo ti : threadMxBean.getThreadInfo(threadMxBean.getAllThreadIds())) {
State st = ti.getThreadState();
AtomicInteger ai = map.get(st);
if(ai==null) {
ai = new AtomicInteger(0);
map.put(st, ai);
}