Java MBean chooseMBean(Set mbeans)

Here you can find the source of chooseMBean(Set mbeans)

Description

choose M Bean

License

Apache License

Declaration

public static ObjectName chooseMBean(Set<ObjectName> mbeans) 

Method Source Code


//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");
    }
}

Related

  1. composeMBeanName(String objTypeName, String objInstanceName)
  2. convertToOpenMBeanAttribute(final MBeanAttributeInfo in, final String prefix)
  3. convertToOpenMBeanOperation(MBeanOperationInfo in)
  4. createMBeanServer()