X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-common-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fcommon%2Futil%2Fjmx%2FQueuedNotificationManagerMXBeanImpl.java;fp=opendaylight%2Fmd-sal%2Fsal-common-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fcommon%2Futil%2Fjmx%2FQueuedNotificationManagerMXBeanImpl.java;h=e6148fcab220d93eff83e1bdb0768961470e969b;hb=51cab2fd826650fa11e624ea4982dbc4a3eb332e;hp=0000000000000000000000000000000000000000;hpb=a8d731931e8d73926557150bcadf478a983ea3dc;p=controller.git diff --git a/opendaylight/md-sal/sal-common-util/src/main/java/org/opendaylight/controller/md/sal/common/util/jmx/QueuedNotificationManagerMXBeanImpl.java b/opendaylight/md-sal/sal-common-util/src/main/java/org/opendaylight/controller/md/sal/common/util/jmx/QueuedNotificationManagerMXBeanImpl.java new file mode 100644 index 0000000000..e6148fcab2 --- /dev/null +++ b/opendaylight/md-sal/sal-common-util/src/main/java/org/opendaylight/controller/md/sal/common/util/jmx/QueuedNotificationManagerMXBeanImpl.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2014 Brocade Communications Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.md.sal.common.util.jmx; + +import java.util.List; + +import org.opendaylight.yangtools.util.concurrent.ListenerNotificationQueueStats; +import org.opendaylight.yangtools.util.concurrent.QueuedNotificationManager; + +import com.google.common.base.Preconditions; + +/** + * Implementation of the QueuedNotificationManagerMXBean interface. + * + *

+ * This class is not intended for use outside of MD-SAL and its part of private + * implementation (still exported as public to be reused across MD-SAL implementation + * components) and may be removed in subsequent + * releases. + * + * @author Thomas Pantelis + */ +public class QueuedNotificationManagerMXBeanImpl extends AbstractMXBean + implements QueuedNotificationManagerMXBean { + + private final QueuedNotificationManager manager; + + public QueuedNotificationManagerMXBeanImpl( QueuedNotificationManager manager, + String mBeanName, String mBeanType, String mBeanCategory ) { + super(mBeanName, mBeanType, mBeanCategory); + this.manager = Preconditions.checkNotNull( manager ); + } + + @Override + public List getCurrentListenerQueueStats() { + return manager.getListenerNotificationQueueStats(); + } + + @Override + public int getMaxListenerQueueSize() { + return manager.getMaxQueueCapacity(); + } + + public QueuedNotificationManagerStats toQueuedNotificationManagerStats() { + return new QueuedNotificationManagerStats( getMaxListenerQueueSize(), + getCurrentListenerQueueStats() ); + } +}