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.common.util.jmx;
11 import com.google.common.base.Preconditions;
12 import java.util.List;
13 import org.opendaylight.yangtools.util.concurrent.ListenerNotificationQueueStats;
14 import org.opendaylight.yangtools.util.concurrent.QueuedNotificationManager;
17 * Implementation of the QueuedNotificationManagerMXBean interface.
20 * This class is not intended for use outside of MD-SAL and its part of private
21 * implementation (still exported as public to be reused across MD-SAL implementation
22 * components) and may be removed in subsequent
25 * @author Thomas Pantelis
27 public class QueuedNotificationManagerMXBeanImpl extends AbstractMXBean
28 implements QueuedNotificationManagerMXBean {
30 private final QueuedNotificationManager<?,?> manager;
32 public QueuedNotificationManagerMXBeanImpl(QueuedNotificationManager<?,?> manager,
33 String beanName, String beanType, String beanCategory) {
34 super(beanName, beanType, beanCategory);
35 this.manager = Preconditions.checkNotNull(manager);
39 public List<ListenerNotificationQueueStats> getCurrentListenerQueueStats() {
40 return manager.getListenerNotificationQueueStats();
44 public int getMaxListenerQueueSize() {
45 return manager.getMaxQueueCapacity();
48 public QueuedNotificationManagerStats toQueuedNotificationManagerStats() {
49 return new QueuedNotificationManagerStats(getMaxListenerQueueSize(), getCurrentListenerQueueStats());