X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fimpl%2FDefaultCommitNotificationProducer.java;h=ab37bac683829a95cc4e78ec24bcfb56c584faf1;hb=1f14b44c584f97e7c992e611e6227e262fe0089e;hp=305fb574243af501f8919211597eeaa9e12a1168;hpb=a92d9d6a21a0f6ca8d2153795721f500eaf29ee9;p=controller.git diff --git a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/DefaultCommitNotificationProducer.java b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/DefaultCommitNotificationProducer.java index 305fb57424..ab37bac683 100644 --- a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/DefaultCommitNotificationProducer.java +++ b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/DefaultCommitNotificationProducer.java @@ -8,6 +8,14 @@ package org.opendaylight.controller.netconf.impl; +import java.util.Set; +import javax.management.InstanceAlreadyExistsException; +import javax.management.InstanceNotFoundException; +import javax.management.MBeanRegistrationException; +import javax.management.MBeanServer; +import javax.management.NotCompliantMBeanException; +import javax.management.NotificationBroadcasterSupport; +import javax.management.ObjectName; import org.opendaylight.controller.netconf.api.jmx.CommitJMXNotification; import org.opendaylight.controller.netconf.api.jmx.DefaultCommitOperationMXBean; import org.opendaylight.controller.netconf.api.jmx.NetconfJMXNotification; @@ -15,20 +23,18 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Element; -import javax.management.*; -import java.util.Set; - 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; - private final ObjectName on = DefaultCommitOperationMXBean.objectName; + private final ObjectName on = DefaultCommitOperationMXBean.OBJECT_NAME; public DefaultCommitNotificationProducer(MBeanServer mBeanServer) { this.mbeanServer = mBeanServer; + LOG.debug("Registering to JMX under {}", on); registerMBean(this, mbeanServer, on); } @@ -36,13 +42,13 @@ public class DefaultCommitNotificationProducer extends NotificationBroadcasterSu 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 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); } @@ -51,7 +57,7 @@ public class DefaultCommitNotificationProducer extends NotificationBroadcasterSu 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); } } }