Repository: hbase Updated Branches: refs/heads/branch-2 2468f3002 -> b9f44bcfe
HBASE-19609 Fixed Checkstyle errors in hbase-metrics and enabled Checkstyle to fail on violations Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/b9f44bcf Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/b9f44bcf Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/b9f44bcf Branch: refs/heads/branch-2 Commit: b9f44bcfe7dd74847bf0c06c083a851b65d278d0 Parents: 2468f30 Author: Jan Hentschel <jan.hentsc...@ultratendency.com> Authored: Sun Dec 24 13:27:25 2017 +0100 Committer: Jan Hentschel <jan.hentsc...@ultratendency.com> Committed: Wed Dec 27 17:39:42 2017 +0100 ---------------------------------------------------------------------- hbase-metrics/pom.xml | 16 ++++++++++++++++ .../hadoop/hbase/metrics/impl/CounterImpl.java | 2 +- .../hadoop/hbase/metrics/impl/DropwizardMeter.java | 4 ++-- .../hbase/metrics/impl/FastLongHistogram.java | 4 ++-- .../hadoop/hbase/metrics/impl/HistogramImpl.java | 4 +--- .../hbase/metrics/impl/MetricRegistriesImpl.java | 4 +--- .../metrics/impl/MetricRegistryFactoryImpl.java | 4 +--- .../hbase/metrics/impl/MetricRegistryImpl.java | 2 +- .../hadoop/hbase/metrics/impl/RefCountingMap.java | 4 +--- .../apache/hadoop/hbase/metrics/impl/TimerImpl.java | 2 +- .../hbase/metrics/impl/TestDropwizardMeter.java | 4 ++-- .../hbase/metrics/impl/TestRefCountingMap.java | 8 +++----- 12 files changed, 32 insertions(+), 26 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/b9f44bcf/hbase-metrics/pom.xml ---------------------------------------------------------------------- diff --git a/hbase-metrics/pom.xml b/hbase-metrics/pom.xml index 0f5ac2a..3107d75 100644 --- a/hbase-metrics/pom.xml +++ b/hbase-metrics/pom.xml @@ -68,6 +68,22 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-checkstyle-plugin</artifactId> + <executions> + <execution> + <id>checkstyle</id> + <phase>validate</phase> + <goals> + <goal>check</goal> + </goals> + <configuration> + <failOnViolation>true</failOnViolation> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> http://git-wip-us.apache.org/repos/asf/hbase/blob/b9f44bcf/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/CounterImpl.java ---------------------------------------------------------------------- diff --git a/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/CounterImpl.java b/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/CounterImpl.java index 848aa5b..8021c06 100644 --- a/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/CounterImpl.java +++ b/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/CounterImpl.java @@ -19,8 +19,8 @@ package org.apache.hadoop.hbase.metrics.impl; import java.util.concurrent.atomic.LongAdder; -import org.apache.yetus.audience.InterfaceAudience; import org.apache.hadoop.hbase.metrics.Counter; +import org.apache.yetus.audience.InterfaceAudience; /** * Custom implementation of {@link org.apache.hadoop.hbase.metrics.Counter} using LongAdder. http://git-wip-us.apache.org/repos/asf/hbase/blob/b9f44bcf/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/DropwizardMeter.java ---------------------------------------------------------------------- diff --git a/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/DropwizardMeter.java b/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/DropwizardMeter.java index 8b3bb80..b5c52cf 100644 --- a/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/DropwizardMeter.java +++ b/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/DropwizardMeter.java @@ -17,12 +17,12 @@ */ package org.apache.hadoop.hbase.metrics.impl; +import com.codahale.metrics.Meter; + import java.util.Objects; import org.apache.yetus.audience.InterfaceAudience; -import com.codahale.metrics.Meter; - /** * Dropwizard metrics implementation of {@link org.apache.hadoop.hbase.metrics.Meter}. */ http://git-wip-us.apache.org/repos/asf/hbase/blob/b9f44bcf/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/FastLongHistogram.java ---------------------------------------------------------------------- diff --git a/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/FastLongHistogram.java b/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/FastLongHistogram.java index a341d21..69f4ae5 100644 --- a/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/FastLongHistogram.java +++ b/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/FastLongHistogram.java @@ -22,10 +22,10 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.LongAdder; import java.util.stream.Stream; -import org.apache.yetus.audience.InterfaceAudience; -import org.apache.yetus.audience.InterfaceStability; import org.apache.hadoop.hbase.metrics.Snapshot; import org.apache.hadoop.hbase.util.AtomicUtils; +import org.apache.yetus.audience.InterfaceAudience; +import org.apache.yetus.audience.InterfaceStability; /** * FastLongHistogram is a thread-safe class that estimate distribution of data and computes the http://git-wip-us.apache.org/repos/asf/hbase/blob/b9f44bcf/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/HistogramImpl.java ---------------------------------------------------------------------- diff --git a/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/HistogramImpl.java b/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/HistogramImpl.java index 910d1cd..6871f7e 100644 --- a/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/HistogramImpl.java +++ b/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/HistogramImpl.java @@ -16,13 +16,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - - package org.apache.hadoop.hbase.metrics.impl; -import org.apache.yetus.audience.InterfaceAudience; import org.apache.hadoop.hbase.metrics.Histogram; import org.apache.hadoop.hbase.metrics.Snapshot; +import org.apache.yetus.audience.InterfaceAudience; /** * Custom histogram implementation based on FastLongHistogram. Dropwizard-based histograms are http://git-wip-us.apache.org/repos/asf/hbase/blob/b9f44bcf/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/MetricRegistriesImpl.java ---------------------------------------------------------------------- diff --git a/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/MetricRegistriesImpl.java b/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/MetricRegistriesImpl.java index 28bdbb4..d72c68f 100644 --- a/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/MetricRegistriesImpl.java +++ b/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/MetricRegistriesImpl.java @@ -16,8 +16,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - - package org.apache.hadoop.hbase.metrics.impl; import java.util.Collection; @@ -25,11 +23,11 @@ import java.util.Collections; import java.util.Optional; import java.util.Set; -import org.apache.yetus.audience.InterfaceAudience; import org.apache.hadoop.hbase.metrics.MetricRegistries; import org.apache.hadoop.hbase.metrics.MetricRegistry; import org.apache.hadoop.hbase.metrics.MetricRegistryFactory; import org.apache.hadoop.hbase.metrics.MetricRegistryInfo; +import org.apache.yetus.audience.InterfaceAudience; /** * Implementation of MetricRegistries that does ref-counting. http://git-wip-us.apache.org/repos/asf/hbase/blob/b9f44bcf/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/MetricRegistryFactoryImpl.java ---------------------------------------------------------------------- diff --git a/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/MetricRegistryFactoryImpl.java b/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/MetricRegistryFactoryImpl.java index e5dbc74..6f9e163 100644 --- a/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/MetricRegistryFactoryImpl.java +++ b/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/MetricRegistryFactoryImpl.java @@ -16,14 +16,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - - package org.apache.hadoop.hbase.metrics.impl; -import org.apache.yetus.audience.InterfaceAudience; import org.apache.hadoop.hbase.metrics.MetricRegistry; import org.apache.hadoop.hbase.metrics.MetricRegistryFactory; import org.apache.hadoop.hbase.metrics.MetricRegistryInfo; +import org.apache.yetus.audience.InterfaceAudience; @InterfaceAudience.Private public class MetricRegistryFactoryImpl implements MetricRegistryFactory { http://git-wip-us.apache.org/repos/asf/hbase/blob/b9f44bcf/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/MetricRegistryImpl.java ---------------------------------------------------------------------- diff --git a/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/MetricRegistryImpl.java b/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/MetricRegistryImpl.java index c5dc849..03c669f 100644 --- a/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/MetricRegistryImpl.java +++ b/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/MetricRegistryImpl.java @@ -22,7 +22,6 @@ import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; -import org.apache.yetus.audience.InterfaceAudience; import org.apache.hadoop.hbase.metrics.Counter; import org.apache.hadoop.hbase.metrics.Gauge; import org.apache.hadoop.hbase.metrics.Histogram; @@ -33,6 +32,7 @@ import org.apache.hadoop.hbase.metrics.MetricRegistryInfo; import org.apache.hadoop.hbase.metrics.MetricSet; import org.apache.hadoop.hbase.metrics.Timer; import org.apache.hadoop.hbase.util.CollectionUtils; +import org.apache.yetus.audience.InterfaceAudience; /** * Custom implementation of {@link MetricRegistry}. http://git-wip-us.apache.org/repos/asf/hbase/blob/b9f44bcf/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/RefCountingMap.java ---------------------------------------------------------------------- diff --git a/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/RefCountingMap.java b/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/RefCountingMap.java index 567ffa8..63131a1 100644 --- a/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/RefCountingMap.java +++ b/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/RefCountingMap.java @@ -16,8 +16,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - - package org.apache.hadoop.hbase.metrics.impl; import java.util.Collection; @@ -69,7 +67,7 @@ class RefCountingMap<K, V> { * @return the value associated with the specified key or null if key is removed from map. */ V remove(K k) { - Payload<V> p = map.computeIfPresent(k, (k1, v) -> --v.refCount <= 0 ? null : v ); + Payload<V> p = map.computeIfPresent(k, (k1, v) -> --v.refCount <= 0 ? null : v); return p == null ? null : p.v; } http://git-wip-us.apache.org/repos/asf/hbase/blob/b9f44bcf/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/TimerImpl.java ---------------------------------------------------------------------- diff --git a/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/TimerImpl.java b/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/TimerImpl.java index 495bc78..03a8c65 100644 --- a/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/TimerImpl.java +++ b/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/TimerImpl.java @@ -19,8 +19,8 @@ package org.apache.hadoop.hbase.metrics.impl; import java.util.concurrent.TimeUnit; -import org.apache.yetus.audience.InterfaceAudience; import org.apache.hadoop.hbase.metrics.Timer; +import org.apache.yetus.audience.InterfaceAudience; /** * Custom implementation of {@link Timer}. http://git-wip-us.apache.org/repos/asf/hbase/blob/b9f44bcf/hbase-metrics/src/test/java/org/apache/hadoop/hbase/metrics/impl/TestDropwizardMeter.java ---------------------------------------------------------------------- diff --git a/hbase-metrics/src/test/java/org/apache/hadoop/hbase/metrics/impl/TestDropwizardMeter.java b/hbase-metrics/src/test/java/org/apache/hadoop/hbase/metrics/impl/TestDropwizardMeter.java index 55f5df3..e48d051 100644 --- a/hbase-metrics/src/test/java/org/apache/hadoop/hbase/metrics/impl/TestDropwizardMeter.java +++ b/hbase-metrics/src/test/java/org/apache/hadoop/hbase/metrics/impl/TestDropwizardMeter.java @@ -17,14 +17,14 @@ */ package org.apache.hadoop.hbase.metrics.impl; +import com.codahale.metrics.Meter; + import org.apache.hadoop.hbase.testclassification.SmallTests; import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; import org.mockito.Mockito; -import com.codahale.metrics.Meter; - /** * Test class for {@link DropwizardMeter}. */ http://git-wip-us.apache.org/repos/asf/hbase/blob/b9f44bcf/hbase-metrics/src/test/java/org/apache/hadoop/hbase/metrics/impl/TestRefCountingMap.java ---------------------------------------------------------------------- diff --git a/hbase-metrics/src/test/java/org/apache/hadoop/hbase/metrics/impl/TestRefCountingMap.java b/hbase-metrics/src/test/java/org/apache/hadoop/hbase/metrics/impl/TestRefCountingMap.java index d4c249c..a776ccd 100644 --- a/hbase-metrics/src/test/java/org/apache/hadoop/hbase/metrics/impl/TestRefCountingMap.java +++ b/hbase-metrics/src/test/java/org/apache/hadoop/hbase/metrics/impl/TestRefCountingMap.java @@ -16,8 +16,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - - package org.apache.hadoop.hbase.metrics.impl; import static org.junit.Assert.assertEquals; @@ -135,7 +133,7 @@ public class TestRefCountingMap { Set<String> keys = map.keySet(); assertEquals(3, keys.size()); - Lists.newArrayList("foo", "bar", "baz").stream().forEach( v -> assertTrue(keys.contains(v))); + Lists.newArrayList("foo", "bar", "baz").stream().forEach(v -> assertTrue(keys.contains(v))); } @Test @@ -148,7 +146,7 @@ public class TestRefCountingMap { Collection<String> values = map.values(); assertEquals(3, values.size()); - Lists.newArrayList("foovalue", "foovalue3", "foovalue4").stream().forEach( - v -> assertTrue(values.contains(v))); + Lists.newArrayList("foovalue", "foovalue3", "foovalue4").stream() + .forEach(v -> assertTrue(values.contains(v))); } }