2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.config.manager.impl.jmx;
10 import javax.management.InstanceAlreadyExistsException;
11 import javax.management.MBeanServer;
12 import org.opendaylight.controller.config.api.jmx.ConfigRegistryMXBean;
13 import org.opendaylight.controller.config.manager.impl.ConfigRegistryImplMXBean;
16 * This registrator is used only to register Config Registry to JMX.
19 public class ConfigRegistryJMXRegistrator implements AutoCloseable {
20 private final InternalJMXRegistrator internalJMXRegistrator;
22 public ConfigRegistryJMXRegistrator(final MBeanServer configMBeanServer) {
23 internalJMXRegistrator = InternalJMXRegistrator.create(configMBeanServer);
26 public AutoCloseable registerToJMX(final ConfigRegistryImplMXBean configRegistry)
27 throws InstanceAlreadyExistsException {
28 return internalJMXRegistrator.registerMBean(configRegistry, ConfigRegistryMXBean.OBJECT_NAME);
33 internalJMXRegistrator.close();