Example usage for javax.management JMX newMBeanProxy

List of usage examples for javax.management JMX newMBeanProxy

Introduction

In this page you can find the example usage for javax.management JMX newMBeanProxy.

Prototype

public static <T> T newMBeanProxy(MBeanServerConnection connection, ObjectName objectName,
        Class<T> interfaceClass, boolean notificationEmitter) 

Source Link

Document

Make a proxy for a Standard MBean in a local or remote MBean Server that may also support the methods of NotificationEmitter .

This method behaves the same as #newMBeanProxy(MBeanServerConnection,ObjectName,Class) , but additionally, if notificationEmitter is true , then the MBean is assumed to be a NotificationBroadcaster or NotificationEmitter and the returned proxy will implement NotificationEmitter as well as interfaceClass .

Usage

From source file:org.apache.hadoop.hdfs.tools.DataNodeAdmin.java

/**
 * Gets the data node mbean proxy/*from   www .  jav  a  2  s.co m*/
 * @return Data node mbean proxy
 * @throws MalformedObjectNameException
 * @throws IOException
 */
private DataNodeMXBean getDataNodeMBeanProxy() throws MalformedObjectNameException, IOException {
    return JMX.newMBeanProxy(mbsc, new ObjectName(DATANODE_NAME), DataNodeMXBean.class, true);
}

From source file:org.novelang.outfit.shell.JmxBeanPool.java

public <BEAN> BEAN getManagedBean(final Class<BEAN> beanClass, final ObjectName beanName, final JmxKit jmxKit)
        throws IOException, InterruptedException {
    checkNotNull(beanClass);/*w  w  w .  j  av  a2  s . c  o m*/
    checkNotNull(beanName);
    checkNotNull(jmxKit);

    final JmxBeanKey key = new JmxBeanKey(beanName, jmxKit);

    final JmxBeanValue value = managedBeans.get(key);
    final BEAN bean;
    if (value == null) {
        final JmxConnectionBundle connectionBundle = getOrCreateConnectionBundle(jmxKit);
        bean = JMX.newMBeanProxy(connectionBundle.connection, beanName, beanClass, true);
        final JmxBeanValue newValue = new JmxBeanValue(connectionBundle, beanName, bean);
        managedBeans.put(key, newValue);
    } else {
        //noinspection unchecked
        bean = (BEAN) value.getJmxBean();
    }
    return bean;
}