2 * Copyright (c) 2014 Brocade Communications 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
9 package org.opendaylight.controller.md.sal.dom.store.impl.jmx;
11 import org.opendaylight.controller.md.sal.common.util.jmx.AbstractMXBean;
12 import org.opendaylight.controller.md.sal.common.util.jmx.QueuedNotificationManagerMXBeanImpl;
13 import org.opendaylight.controller.md.sal.common.util.jmx.ThreadExecutorStatsMXBeanImpl;
14 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
15 import org.opendaylight.yangtools.util.concurrent.QueuedNotificationManager;
18 * Wrapper class for data store MXbeans.
20 * @author Thomas Pantelis
22 public class InMemoryDataStoreStats implements AutoCloseable {
24 private final AbstractMXBean notificationExecutorStatsBean;
25 private final QueuedNotificationManagerMXBeanImpl notificationManagerStatsBean;
27 public InMemoryDataStoreStats(final String mBeanType, final QueuedNotificationManager<?, ?> manager) {
29 notificationManagerStatsBean = new QueuedNotificationManagerMXBeanImpl(manager,
30 "notification-manager", mBeanType, null);
31 notificationManagerStatsBean.registerMBean();
33 notificationExecutorStatsBean = ThreadExecutorStatsMXBeanImpl.create(manager.getExecutor(),
34 "notification-executor", mBeanType, null);
35 if (notificationExecutorStatsBean != null) {
36 notificationExecutorStatsBean.registerMBean();
40 public InMemoryDataStoreStats(final String name, final InMemoryDOMDataStore dataStore) {
41 this(name, dataStore.getDataChangeListenerNotificationManager());
45 public void close() throws Exception {
46 if(notificationExecutorStatsBean != null) {
47 notificationExecutorStatsBean.unregisterMBean();
50 if(notificationManagerStatsBean != null) {
51 notificationManagerStatsBean.unregisterMBean();