Example usage for javax.management.remote JMXConnectionNotification getConnectionId

List of usage examples for javax.management.remote JMXConnectionNotification getConnectionId

Introduction

In this page you can find the example usage for javax.management.remote JMXConnectionNotification getConnectionId.

Prototype

public String getConnectionId() 

Source Link

Document

The connection ID to which this notification pertains.

Usage

From source file:org.apache.geode.admin.jmx.internal.AgentImpl.java

/**
 * If the handback object passed is an AgentImpl, updates the JMX client count
 *
 * @param notification JMXConnectionNotification for change in client connection status
 * @param handback An opaque object which helps the listener to associate information regarding
 *        the MBean emitter. This object is passed to the MBean during the addListener call and
 *        resent, without modification, to the listener. The MBean object should not use or modify
 *        the object. (NOTE: copied from javax.management.NotificationListener)
 *//*ww w.  java2s  .c  o m*/
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "BC_UNCONFIRMED_CAST", justification = "Only JMXConnectionNotification instances are used.")
public void handleNotification(Notification notification, Object handback) {
    if (handback instanceof AgentImpl) {
        AgentImpl agent = (AgentImpl) handback;

        JMXConnectionNotification jmxNotifn = (JMXConnectionNotification) notification;

        if (logger.isDebugEnabled()) {
            logger.debug("Connection notification for connection id : '{}'", jmxNotifn.getConnectionId());
        }

        agent.updateRmiClientsCount();
    }
}