diff --git a/helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/WagedRebalancer.java b/helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/WagedRebalancer.java index 5b2573fa4d..4cd704fd73 100644 --- a/helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/WagedRebalancer.java +++ b/helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/WagedRebalancer.java @@ -186,7 +186,7 @@ public Map computeNewIdealStates(ResourceControllerDataProvi CountMetric rebalanceFailureCount = _metricCollector.getMetric( WagedRebalancerMetricCollector.WagedRebalancerMetricNames.RebalanceFailureCounter.name(), CountMetric.class); - rebalanceFailureCount.increaseCount(1L); + rebalanceFailureCount.increment(1L); HelixRebalanceException.Type failureType = ex.getFailureType(); if (failureType.equals(HelixRebalanceException.Type.INVALID_REBALANCER_STATUS) || failureType @@ -335,7 +335,7 @@ private void refreshBaseline(ResourceControllerDataProvider clusterData, CountMetric globalBaselineCalcCounter = _metricCollector.getMetric( WagedRebalancerMetricCollector.WagedRebalancerMetricNames.GlobalBaselineCalcCounter.name(), CountMetric.class); - globalBaselineCalcCounter.increaseCount(1L); + globalBaselineCalcCounter.increment(1L); LatencyMetric globalBaselineCalcLatency = _metricCollector.getMetric( WagedRebalancerMetricCollector.WagedRebalancerMetricNames.GlobalBaselineCalcLatencyGauge @@ -382,7 +382,7 @@ private Map partialRebalance( CountMetric partialRebalanceCounter = _metricCollector.getMetric( WagedRebalancerMetricCollector.WagedRebalancerMetricNames.PartialRebalanceCounter.name(), CountMetric.class); - partialRebalanceCounter.increaseCount(1L); + partialRebalanceCounter.increment(1L); LatencyMetric partialRebalanceLatency = _metricCollector.getMetric( WagedRebalancerMetricCollector.WagedRebalancerMetricNames.PartialRebalanceLatencyGauge diff --git a/helix-core/src/main/java/org/apache/helix/monitoring/metrics/implementation/RebalanceCounter.java b/helix-core/src/main/java/org/apache/helix/monitoring/metrics/implementation/RebalanceCounter.java index fc370a85c1..8ecce7c0c1 100644 --- a/helix-core/src/main/java/org/apache/helix/monitoring/metrics/implementation/RebalanceCounter.java +++ b/helix-core/src/main/java/org/apache/helix/monitoring/metrics/implementation/RebalanceCounter.java @@ -27,15 +27,10 @@ */ public class RebalanceCounter extends CountMetric { /** - * Instantiates a new count metric. + * Instantiates a new rebalance count metric. * @param metricName the metric name */ public RebalanceCounter(String metricName) { super(metricName, 0L); } - - @Override - public void increaseCount(long count) { - updateValue(getValue() + count); - } } diff --git a/helix-core/src/main/java/org/apache/helix/monitoring/metrics/implementation/RebalanceFailureCount.java b/helix-core/src/main/java/org/apache/helix/monitoring/metrics/implementation/RebalanceFailureCount.java index 3764645563..fd335f2c59 100644 --- a/helix-core/src/main/java/org/apache/helix/monitoring/metrics/implementation/RebalanceFailureCount.java +++ b/helix-core/src/main/java/org/apache/helix/monitoring/metrics/implementation/RebalanceFailureCount.java @@ -1,7 +1,27 @@ package org.apache.helix.monitoring.metrics.implementation; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import org.apache.helix.monitoring.metrics.model.CountMetric; + public class RebalanceFailureCount extends CountMetric { /** * Instantiates a new Simple dynamic metric. @@ -11,9 +31,4 @@ public class RebalanceFailureCount extends CountMetric { public RebalanceFailureCount(String metricName) { super(metricName, 0L); } - - @Override - public void increaseCount(long count) { - updateValue(getValue() + count); - } } diff --git a/helix-core/src/main/java/org/apache/helix/monitoring/metrics/model/CountMetric.java b/helix-core/src/main/java/org/apache/helix/monitoring/metrics/model/CountMetric.java index 81aa001742..c64f7613bc 100644 --- a/helix-core/src/main/java/org/apache/helix/monitoring/metrics/model/CountMetric.java +++ b/helix-core/src/main/java/org/apache/helix/monitoring/metrics/model/CountMetric.java @@ -43,7 +43,9 @@ public CountMetric(String metricName, long initCount) { * * @param count */ - public abstract void increaseCount(long count); + public void increment(long count) { + updateValue(getValue() + count); + } @Override public String getMetricName() {