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.yangtools.util.concurrent;
10 import static java.util.Objects.requireNonNull;
12 import java.util.List;
13 import java.util.stream.Collectors;
15 final class QueuedNotificationManagerMXBeanImpl implements QueuedNotificationManagerMXBean {
16 private final AbstractQueuedNotificationManager<?, ?, ?> manager;
18 QueuedNotificationManagerMXBeanImpl(final AbstractQueuedNotificationManager<?, ?, ?> manager) {
19 this.manager = requireNonNull(manager);
23 * Returns a list of stat instances for each current listener notification task in progress.
26 public List<ListenerNotificationQueueStats> getCurrentListenerQueueStats() {
27 return manager.streamTasks().map(t -> new ListenerNotificationQueueStats(t.key().toString(), t.size()))
28 .collect(Collectors.toList());
32 * Returns the configured maximum listener queue size.
35 public int getMaxListenerQueueSize() {
36 return manager.getMaxQueueCapacity();