X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fconfig%2Fconfig-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Futil%2FConfigRegistryJMXClient.java;h=74dd2efed83468d3f9b7dd48b30ca601208a65b3;hb=23fe9ca678ada6263fec5dd996f4025e4a32fcf5;hp=099d010642ee510052a43ade62b77e2e20f2a884;hpb=d70f418d19fa09b1efc8fa4ce4ed35f0cf59b73b;p=controller.git diff --git a/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/ConfigRegistryJMXClient.java b/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/ConfigRegistryJMXClient.java index 099d010642..74dd2efed8 100644 --- a/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/ConfigRegistryJMXClient.java +++ b/opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/ConfigRegistryJMXClient.java @@ -26,6 +26,7 @@ import org.opendaylight.controller.config.api.jmx.CommitStatus; import org.opendaylight.controller.config.api.jmx.ConfigRegistryMXBean; import org.opendaylight.controller.config.api.jmx.ObjectNameUtil; import org.opendaylight.controller.config.api.jmx.ServiceReferenceMXBean; +import org.opendaylight.controller.config.api.jmx.constants.ConfigRegistryConstants; public class ConfigRegistryJMXClient implements ConfigRegistryClient { private final ConfigRegistryMXBean configRegistryMXBeanProxy; @@ -33,10 +34,13 @@ public class ConfigRegistryJMXClient implements ConfigRegistryClient { private final MBeanServer configMBeanServer; public ConfigRegistryJMXClient(MBeanServer configMBeanServer) { + this(configMBeanServer, OBJECT_NAME); + } + + private ConfigRegistryJMXClient(MBeanServer configMBeanServer, ObjectName configRegistryON) { this.configMBeanServer = configMBeanServer; - configRegistryON = OBJECT_NAME; - Set searchResult = configMBeanServer.queryMBeans( - configRegistryON, null); + this.configRegistryON = configRegistryON; + Set searchResult = configMBeanServer.queryMBeans(configRegistryON, null); if (!(searchResult.size() == 1)) { throw new IllegalStateException("Config registry not found"); } @@ -44,6 +48,10 @@ public class ConfigRegistryJMXClient implements ConfigRegistryClient { false); } + public static ConfigRegistryJMXClient createWithoutNotifications(MBeanServer configMBeanServer) { + return new ConfigRegistryJMXClient(configMBeanServer, ConfigRegistryConstants.OBJECT_NAME_NO_NOTIFICATIONS); + } + @Override public ConfigTransactionJMXClient createTransaction() { ObjectName configTransactionControllerON = beginConfig(); @@ -211,7 +219,7 @@ public class ConfigRegistryJMXClient implements ConfigRegistryClient { } catch (AttributeNotFoundException | InstanceNotFoundException | MBeanException | ReflectionException e) { throw new RuntimeException("Unable to get attribute " - + attributeName + " for " + on, e); + + attributeName + " for " + on + ". Available beans: " + lookupConfigBeans(), e); } }