package org.opendaylight.controller.netconf.impl;
-import org.opendaylight.controller.netconf.api.jmx.CommitJMXNotification;
-import org.opendaylight.controller.netconf.api.jmx.DefaultCommitOperationMXBean;
-import org.opendaylight.controller.netconf.api.jmx.NetconfJMXNotification;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Element;
-
+import java.util.Set;
import javax.management.InstanceAlreadyExistsException;
import javax.management.InstanceNotFoundException;
import javax.management.MBeanRegistrationException;
import javax.management.NotCompliantMBeanException;
import javax.management.NotificationBroadcasterSupport;
import javax.management.ObjectName;
-import java.util.Set;
+import org.opendaylight.controller.netconf.api.jmx.CommitJMXNotification;
+import org.opendaylight.controller.netconf.api.jmx.DefaultCommitOperationMXBean;
+import org.opendaylight.controller.netconf.api.jmx.NetconfJMXNotification;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Element;
public class DefaultCommitNotificationProducer extends NotificationBroadcasterSupport implements
DefaultCommitOperationMXBean, AutoCloseable {
- private static final Logger logger = LoggerFactory.getLogger(DefaultCommitNotificationProducer.class);
+ private static final Logger LOG = LoggerFactory.getLogger(DefaultCommitNotificationProducer.class);
private final MBeanServer mbeanServer;
public DefaultCommitNotificationProducer(MBeanServer mBeanServer) {
this.mbeanServer = mBeanServer;
+ LOG.debug("Registering to JMX under {}", on);
registerMBean(this, mbeanServer, on);
}
try {
mbs.registerMBean(instance, on);
} catch (InstanceAlreadyExistsException | MBeanRegistrationException | NotCompliantMBeanException e) {
- throw new RuntimeException("Unable to register " + instance + " as " + on, e);
+ throw new IllegalStateException("Unable to register " + instance + " as " + on, e);
}
}
public void sendCommitNotification(String message, Element cfgSnapshot, Set<String> capabilities) {
CommitJMXNotification notif = NetconfJMXNotification.afterCommit(this, message, cfgSnapshot, capabilities);
- logger.debug("Notification about commit {} sent", notif);
+ LOG.debug("Notification about commit {} sent", notif);
sendNotification(notif);
}
try {
mbeanServer.unregisterMBean(on);
} catch (InstanceNotFoundException | MBeanRegistrationException e) {
- logger.warn("Ignoring exception while unregistering {} as {}", this, on, e);
+ LOG.warn("Ignoring exception while unregistering {} as {}", this, on, e);
}
}
}