Merge branch 'master' of ../controller
[yangtools.git] / common / util / src / main / java / org / opendaylight / yangtools / util / concurrent / QueuedNotificationManagerMXBeanImpl.java
1 /*
2  * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.util.concurrent;
9
10 import static java.util.Objects.requireNonNull;
11
12 import java.util.List;
13
14 final class QueuedNotificationManagerMXBeanImpl implements QueuedNotificationManagerMXBean {
15     private final QueuedNotificationManager<?, ?> manager;
16
17     QueuedNotificationManagerMXBeanImpl(final QueuedNotificationManager<?, ?> manager) {
18         this.manager = requireNonNull(manager);
19     }
20
21     /**
22      * Returns a list of stat instances for each current listener notification task in progress.
23      */
24     @Override
25     public List<ListenerNotificationQueueStats> getCurrentListenerQueueStats() {
26         return manager.getListenerNotificationQueueStats();
27     }
28
29     /**
30      * Returns the configured maximum listener queue size.
31      */
32     @Override
33     public int getMaxListenerQueueSize() {
34         return manager.getMaxQueueCapacity();
35     }
36 }