Example usage for javax.management MBeanServerConnection unregisterMBean

List of usage examples for javax.management MBeanServerConnection unregisterMBean

Introduction

In this page you can find the example usage for javax.management MBeanServerConnection unregisterMBean.

Prototype

public void unregisterMBean(ObjectName name)
        throws InstanceNotFoundException, MBeanRegistrationException, IOException;

Source Link

Document

Unregisters an MBean from the MBean server.

Usage

From source file:org.helios.collector.jmx.connection.AbstractMBeanServerConnectionFactory.java

/**
 * Unregisters an MBean identified by the passed ObjectName
 * @param objectName//from   ww w . j av  a  2 s  .  c  o  m
 * @throws InstanceNotFoundException
 * @throws MBeanRegistrationException
 * @throws IOException
 */
@Override
@ManagedOperation
public void unregisterMBean(ObjectName objectName)
        throws InstanceNotFoundException, MBeanRegistrationException, IOException {
    validateConn();
    MBeanServerConnection conn = null;
    try {
        conn = getPooledConnection();
        conn.unregisterMBean(objectName);
    } catch (MBeanServerConnectionFactoryException e) {
        throw new RuntimeException("Failed to get pooled connection", e);
    } finally {
        try {
            this.returnPooledConnection(conn);
        } catch (Exception e) {
            log.debug(e.getMessage());
        }
    }

}