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;
13 import org.opendaylight.controller.md.sal.common.util.jmx.AbstractMXBean;
14 import org.opendaylight.yangtools.util.DurationStatsTracker;
17 * Implementation of the CommitStatsMXBean interface.
19 * @author Thomas Pantelis
21 public class CommitStatsMXBeanImpl extends AbstractMXBean implements CommitStatsMXBean {
23 private final DurationStatsTracker commitStatsTracker;
28 * @param commitStatsTracker the DurationStatsTracker used to obtain the stats.
29 * @param mBeanType mBeanType Used as the <code>type</code> property in the bean's ObjectName.
31 public CommitStatsMXBeanImpl(@Nonnull DurationStatsTracker commitStatsTracker,
32 @Nonnull String mBeanType) {
33 super("CommitStats", mBeanType, null);
34 this.commitStatsTracker = commitStatsTracker;
38 public long getTotalCommits() {
39 return commitStatsTracker.getTotalDurations();
43 public String getLongestCommitTime() {
44 return commitStatsTracker.getDisplayableLongestDuration();
48 public String getShortestCommitTime() {
49 return commitStatsTracker.getDisplayableShortestDuration();
53 public String getAverageCommitTime() {
54 return commitStatsTracker.getDisplayableAverageDuration();
58 public void clearStats() {
59 commitStatsTracker.reset();