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.dom.broker.impl.jmx;
11 import javax.annotation.Nonnull;
12 import org.opendaylight.controller.md.sal.common.util.jmx.AbstractMXBean;
13 import org.opendaylight.yangtools.util.DurationStatisticsTracker;
16 * Implementation of the CommitStatsMXBean interface.
18 * @author Thomas Pantelis
20 public class CommitStatsMXBeanImpl extends AbstractMXBean implements CommitStatsMXBean {
22 private final DurationStatisticsTracker commitStatsTracker;
27 * @param commitStatsTracker the DurationStatsTracker used to obtain the stats.
28 * @param mBeanType mBeanType Used as the <code>type</code> property in the bean's ObjectName.
30 public CommitStatsMXBeanImpl(@Nonnull DurationStatisticsTracker commitStatsTracker,
31 @Nonnull String mBeanType) {
32 super("CommitStats", mBeanType, null);
33 this.commitStatsTracker = commitStatsTracker;
37 public long getTotalCommits() {
38 return commitStatsTracker.getTotalDurations();
42 public String getLongestCommitTime() {
43 return commitStatsTracker.getDisplayableLongestDuration();
47 public String getShortestCommitTime() {
48 return commitStatsTracker.getDisplayableShortestDuration();
52 public String getAverageCommitTime() {
53 return commitStatsTracker.getDisplayableAverageDuration();
57 public void clearStats() {
58 commitStatsTracker.reset();