Example usage for org.apache.zookeeper.jmx ZKMBeanInfo getName

List of usage examples for org.apache.zookeeper.jmx ZKMBeanInfo getName

Introduction

In this page you can find the example usage for org.apache.zookeeper.jmx ZKMBeanInfo getName.

Prototype

String getName();

Source Link

Usage

From source file:org.apache.bookkeeper.jmx.BKMBeanRegistry.java

License:Apache License

/**
 * Builds an MBean path and creates an ObjectName instance using the path. 
 * @param path MBean path//  ww  w  .  ja  va  2 s . c  om
 * @param bean the MBean instance
 * @return ObjectName to be registered with the platform MBean server
 */
protected ObjectName makeObjectName(String path, ZKMBeanInfo bean) throws MalformedObjectNameException {
    if (path == null)
        return null;
    StringBuilder beanName = new StringBuilder(getDomainName() + ":");
    int counter = 0;
    counter = tokenize(beanName, path, counter);
    tokenize(beanName, bean.getName(), counter);
    beanName.deleteCharAt(beanName.length() - 1);
    try {
        return new ObjectName(beanName.toString());
    } catch (MalformedObjectNameException e) {
        LOG.warn("Invalid name \"" + beanName.toString() + "\" for class " + bean.getClass().toString());
        throw e;
    }
}