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
8 package org.opendaylight.controller.md.sal.common.util.jmx;
10 import static java.util.Objects.requireNonNull;
12 import java.util.List;
13 import org.opendaylight.yangtools.util.concurrent.ListenerNotificationQueueStats;
14 import org.opendaylight.yangtools.util.concurrent.QueuedNotificationManager;
15 import org.opendaylight.yangtools.util.concurrent.QueuedNotificationManagerMXBean;
18 * Implementation of the QueuedNotificationManagerMXBean interface.
21 * This class is not intended for use outside of MD-SAL and its part of private
22 * implementation (still exported as public to be reused across MD-SAL implementation
23 * components) and may be removed in subsequent
26 * @author Thomas Pantelis
28 public class QueuedNotificationManagerMXBeanImpl extends AbstractMXBean
29 implements QueuedNotificationManagerMXBean {
31 private final QueuedNotificationManager<?,?> manager;
33 public QueuedNotificationManagerMXBeanImpl(final QueuedNotificationManager<?,?> manager,
34 final String beanName, final String beanType, final String beanCategory) {
35 super(beanName, beanType, beanCategory);
36 this.manager = requireNonNull(manager);
40 public List<ListenerNotificationQueueStats> getCurrentListenerQueueStats() {
41 return manager.getListenerNotificationQueueStats();
45 public int getMaxListenerQueueSize() {
46 return manager.getMaxQueueCapacity();
49 public QueuedNotificationManagerStats toQueuedNotificationManagerStats() {
50 return new QueuedNotificationManagerStats(getMaxListenerQueueSize(), getCurrentListenerQueueStats());