Java Utililty Methods MBean

List of utility methods to do MBean

  1. HOME
  2. Java
  3. M
  4. MBean

Description

The list of methods to do MBean are organized into topic(s).

Method

ObjectName chooseMBean(Set mbeans)
choose M Bean
if (mbeans.size() == 1) {
 return mbeans.iterator().next();
for (ObjectName mbean : mbeans) {
 if (!isHawtioDummy(mbean.toString())) {
 return mbean;
return null;
ObjectName composeMBeanName(String objTypeName, String objInstanceName)
compose M Bean Name
String name = "com.cloud:type=" + objTypeName;
if (objInstanceName != null && !objInstanceName.isEmpty())
 name += ", name=" + objInstanceName;
return new ObjectName(name);
OpenMBeanAttributeInfo convertToOpenMBeanAttribute(final MBeanAttributeInfo in, final String prefix)
convert To Open M Bean Attribute
return createOpenMBeanAttributeInfo(getOpenType(in.getType()), in, prefix);
OpenMBeanOperationInfo convertToOpenMBeanOperation(MBeanOperationInfo in)
convert To Open M Bean Operation
return convertToOpenMBeanOperation(in, null, null);
MBeanServer createMBeanServer()
Create and configure (if necessary) and return the MBeanServer with which we will be registering our ModelMBean implementations.
if (mbeanServer == null) {
 mbeanServer = MBeanServerFactory.createMBeanServer(DEFAULT_DOMAIN);
return mbeanServer;
OpenMBeanAttributeInfo createOpenMBeanAttributeInfo(final OpenType type, final MBeanAttributeInfo in, final String prefix)
create Open M Bean Attribute Info
return new OpenMBeanAttributeInfoSupport(((prefix != null) ? prefix + in.getName() : in.getName()),
 in.getDescription(), type, in.isReadable(), in.isWritable(), in.isIs());
Object createProxy(final ObjectName objectName, final Class mbeanInterface, final MBeanServer mbeanServer)
create Proxy
return MBeanServerInvocationHandler.newProxyInstance(mbeanServer, objectName, mbeanInterface, false);
ObjectInstance createTimerMBean(ObjectName name, MBeanServer server)
create Timer M Bean
return server.createMBean(TIMER_MBEAN_CLASSNAME, name, null, null);
void dumpAttributes(MBeanAttributeInfo[] attributes)
dump Attributes
System.out.println("");
System.out.println("Attributes:");
for (int i = 0; i < attributes.length; i++) {
 StringBuffer dump = new StringBuffer();
 MBeanAttributeInfo attribute = attributes[i];
 dump.append("name=").append(attribute.getName());
 dump.append(",type=").append(attribute.getType());
 dump.append(",readable=").append(attribute.isReadable());
...
void dumpConstructors(MBeanConstructorInfo[] constructors)
dump Constructors
System.out.println("");
System.out.println("Constructors:");
for (int i = 0; i < constructors.length; i++) {
 StringBuffer dump = new StringBuffer();
 MBeanConstructorInfo constructor = constructors[i];
 dump.append("name=").append(constructor.getName());
 dump.append(",signature=").append(makeSignatureString(constructor.getSignature()));
 System.out.println(dump);
...


AltStyle によって変換されたページ (->オリジナル) /