Example usage for javax.management MBeanServerConnection removeNotificationListener

List of usage examples for javax.management MBeanServerConnection removeNotificationListener

Introduction

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

Prototype

public void removeNotificationListener(ObjectName name, NotificationListener listener,
        NotificationFilter filter, Object handback)
        throws InstanceNotFoundException, ListenerNotFoundException, IOException;

Source Link

Document

Removes a listener from a registered MBean.

The MBean must have a listener that exactly matches the given listener, filter, and handback parameters.

Usage

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

/**
 * Removes a registered notification listener
 * @param objectName/*from w w  w. j av  a 2 s.co  m*/
 * @param listener
 * @param filter
 * @param handback
 * @throws InstanceNotFoundException
 * @throws ListenerNotFoundException
 * @throws IOException
 */
@Override
@ManagedOperation
public void removeNotificationListener(ObjectName objectName, ObjectName listener, NotificationFilter filter,
        Object handback) throws InstanceNotFoundException, ListenerNotFoundException, IOException {
    validateConn();
    MBeanServerConnection conn = null;
    try {
        conn = getPooledConnection();
        conn.removeNotificationListener(objectName, listener, filter, handback);
    } catch (MBeanServerConnectionFactoryException e) {
        throw new RuntimeException("Failed to get pooled connection", e);
    } finally {
        try {
            this.returnPooledConnection(conn);
        } catch (Exception e) {
            log.debug(e.getMessage());
        }
    }
}

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

/**
 * Removes a registered notification listener
 * @param objectName/*from   www  .j  av a 2  s . c o  m*/
 * @param listener
 * @param filter
 * @param handback
 * @throws InstanceNotFoundException
 * @throws ListenerNotFoundException
 * @throws IOException
 */
@Override
@ManagedOperation
public void removeNotificationListener(ObjectName objectName, NotificationListener listener,
        NotificationFilter filter, Object handback)
        throws InstanceNotFoundException, ListenerNotFoundException, IOException {
    validateConn();
    MBeanServerConnection conn = null;
    try {
        conn = getPooledConnection();
        conn.removeNotificationListener(objectName, listener, filter, handback);
    } catch (MBeanServerConnectionFactoryException e) {
        throw new RuntimeException("Failed to get pooled connection", e);
    } finally {
        try {
            this.returnPooledConnection(conn);
        } catch (Exception e) {
            log.debug(e.getMessage());
        }
    }
}