Here you can find the source of chooseMBean(Set
public static ObjectName chooseMBean(Set<ObjectName> mbeans)
//package com.java2s; //License from project: Apache License import javax.management.ObjectName; import java.util.Set; public class Main { public static ObjectName chooseMBean(Set<ObjectName> mbeans) { if (mbeans.size() == 1) { return mbeans.iterator().next(); }/*from w w w . j a v a 2s . c om*/ for (ObjectName mbean : mbeans) { if (!isHawtioDummy(mbean.toString())) { return mbean; } } return null; } private static boolean isHawtioDummy(String name) { return name.contains("HawtioDummy"); } }