Repository: hbase
Updated Branches:
  refs/heads/branch-2 3c9c221c2 -> 26e54e42c


http://git-wip-us.apache.org/repos/asf/hbase/blob/26e54e42/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/impl/JmxCacheBuster.java
----------------------------------------------------------------------
diff --git 
a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/impl/JmxCacheBuster.java
 
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/impl/JmxCacheBuster.java
index 7350d1e..fbcd9fc 100644
--- 
a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/impl/JmxCacheBuster.java
+++ 
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/impl/JmxCacheBuster.java
@@ -22,13 +22,13 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicReference;
 
-import org.apache.yetus.audience.InterfaceAudience;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.hadoop.metrics2.MetricsExecutor;
 import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
 import org.apache.hadoop.metrics2.lib.MetricsExecutorImpl;
 import org.apache.hadoop.util.StringUtils;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import 
org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
 
@@ -41,7 +41,7 @@ import 
org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesti
  * are package private.
  */
 @InterfaceAudience.Private
-public class JmxCacheBuster {
+public final class JmxCacheBuster {
   private static final Logger LOG = 
LoggerFactory.getLogger(JmxCacheBuster.class);
   private static AtomicReference<ScheduledFuture> fut = new 
AtomicReference<>(null);
   private static MetricsExecutor executor = new MetricsExecutorImpl();

http://git-wip-us.apache.org/repos/asf/hbase/blob/26e54e42/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/DefaultMetricsSystemHelper.java
----------------------------------------------------------------------
diff --git 
a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/DefaultMetricsSystemHelper.java
 
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/DefaultMetricsSystemHelper.java
index 87b83e5..723e6d3 100644
--- 
a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/DefaultMetricsSystemHelper.java
+++ 
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/DefaultMetricsSystemHelper.java
@@ -92,8 +92,8 @@ public class DefaultMetricsSystemHelper {
       }
     } catch (Exception ex) {
       if (LOG.isTraceEnabled()) {
-        LOG.trace("Received exception while trying to access Hadoop Metrics 
classes via reflection.",
-            ex);
+        LOG.trace("Received exception while trying to access Hadoop Metrics 
classes via " +
+                        "reflection.", ex);
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/26e54e42/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/DynamicMetricsRegistry.java
----------------------------------------------------------------------
diff --git 
a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/DynamicMetricsRegistry.java
 
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/DynamicMetricsRegistry.java
index 62fa6ea..7e17ee9 100644
--- 
a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/DynamicMetricsRegistry.java
+++ 
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/DynamicMetricsRegistry.java
@@ -21,15 +21,15 @@ package org.apache.hadoop.metrics2.lib;
 import java.util.Collection;
 import java.util.concurrent.ConcurrentMap;
 
-import org.apache.yetus.audience.InterfaceAudience;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.hadoop.hbase.metrics.Interns;
 import org.apache.hadoop.metrics2.MetricsException;
 import org.apache.hadoop.metrics2.MetricsInfo;
 import org.apache.hadoop.metrics2.MetricsRecordBuilder;
 import org.apache.hadoop.metrics2.MetricsTag;
 import org.apache.hadoop.metrics2.impl.MsInfo;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import org.apache.hbase.thirdparty.com.google.common.base.MoreObjects;
 import org.apache.hbase.thirdparty.com.google.common.collect.Maps;
@@ -56,14 +56,14 @@ public class DynamicMetricsRegistry {
   private final MetricsInfo metricsInfo;
   private final DefaultMetricsSystemHelper helper = new 
DefaultMetricsSystemHelper();
   private final static String[] histogramSuffixes = new String[]{
-      "_num_ops",
-      "_min",
-      "_max",
-      "_median",
-      "_75th_percentile",
-      "_90th_percentile",
-      "_95th_percentile",
-      "_99th_percentile"};
+    "_num_ops",
+    "_min",
+    "_max",
+    "_median",
+    "_75th_percentile",
+    "_90th_percentile",
+    "_95th_percentile",
+    "_99th_percentile"};
 
   /**
    * Construct the registry with a record name
@@ -215,7 +215,10 @@ public class DynamicMetricsRegistry {
     if (returnExisting) {
       MutableMetric rate = metricsMap.get(name);
       if (rate != null) {
-        if (rate instanceof MutableRate) return (MutableRate) rate;
+        if (rate instanceof MutableRate) {
+          return (MutableRate) rate;
+        }
+
         throw new MetricsException("Unexpected metrics type "+ rate.getClass()
                                    +" for "+ name);
       }
@@ -230,7 +233,7 @@ public class DynamicMetricsRegistry {
    * @return A new MutableHistogram
    */
   public MutableHistogram newHistogram(String name) {
-     return newHistogram(name, "");
+    return newHistogram(name, "");
   }
 
   /**
@@ -250,7 +253,7 @@ public class DynamicMetricsRegistry {
    * @return A new MutableTimeHistogram
    */
   public MutableTimeHistogram newTimeHistogram(String name) {
-     return newTimeHistogram(name, "");
+    return newTimeHistogram(name, "");
   }
 
   /**
@@ -270,7 +273,7 @@ public class DynamicMetricsRegistry {
    * @return A new MutableSizeHistogram
    */
   public MutableSizeHistogram newSizeHistogram(String name) {
-     return newSizeHistogram(name, "");
+    return newSizeHistogram(name, "");
   }
 
   /**
@@ -497,10 +500,8 @@ public class DynamicMetricsRegistry {
     return (MutableHistogram) histo;
   }
 
-  private<T extends MutableMetric> T
-  addNewMetricIfAbsent(String name,
-                       T ret,
-                       Class<T> metricClass) {
+  private<T extends MutableMetric> T addNewMetricIfAbsent(String name, T ret,
+      Class<T> metricClass) {
     //If the value we get back is null then the put was successful and we will
     // return that. Otherwise metric should contain the thing that was in
     // before the put could be completed.

http://git-wip-us.apache.org/repos/asf/hbase/blob/26e54e42/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MetricsExecutorImpl.java
----------------------------------------------------------------------
diff --git 
a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MetricsExecutorImpl.java
 
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MetricsExecutorImpl.java
index a981144..d24f23f 100644
--- 
a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MetricsExecutorImpl.java
+++ 
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MetricsExecutorImpl.java
@@ -23,8 +23,8 @@ import java.util.concurrent.ScheduledThreadPoolExecutor;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import org.apache.yetus.audience.InterfaceAudience;
 import org.apache.hadoop.metrics2.MetricsExecutor;
+import org.apache.yetus.audience.InterfaceAudience;
 
 /**
  *  Class to handle the ScheduledExecutorService{@link 
ScheduledExecutorService} used by

http://git-wip-us.apache.org/repos/asf/hbase/blob/26e54e42/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableHistogram.java
----------------------------------------------------------------------
diff --git 
a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableHistogram.java
 
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableHistogram.java
index bbead0b..df78a5a 100644
--- 
a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableHistogram.java
+++ 
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableHistogram.java
@@ -19,7 +19,6 @@
 package org.apache.hadoop.metrics2.lib;
 
 import org.apache.commons.lang3.StringUtils;
-import org.apache.yetus.audience.InterfaceAudience;
 import org.apache.hadoop.hbase.metrics.Histogram;
 import org.apache.hadoop.hbase.metrics.Interns;
 import org.apache.hadoop.hbase.metrics.Snapshot;
@@ -27,6 +26,7 @@ import org.apache.hadoop.hbase.metrics.impl.HistogramImpl;
 import org.apache.hadoop.metrics2.MetricHistogram;
 import org.apache.hadoop.metrics2.MetricsInfo;
 import org.apache.hadoop.metrics2.MetricsRecordBuilder;
+import org.apache.yetus.audience.InterfaceAudience;
 
 /**
  * A histogram implementation that runs in constant space, and exports to 
hadoop2's metrics2 system.

http://git-wip-us.apache.org/repos/asf/hbase/blob/26e54e42/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableRangeHistogram.java
----------------------------------------------------------------------
diff --git 
a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableRangeHistogram.java
 
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableRangeHistogram.java
index 3265caf..4c800c4 100644
--- 
a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableRangeHistogram.java
+++ 
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableRangeHistogram.java
@@ -18,12 +18,13 @@
 
 package org.apache.hadoop.metrics2.lib;
 
-import org.apache.yetus.audience.InterfaceAudience;
 import org.apache.hadoop.hbase.metrics.Interns;
 import org.apache.hadoop.hbase.metrics.Snapshot;
 import org.apache.hadoop.metrics2.MetricHistogram;
 import org.apache.hadoop.metrics2.MetricsInfo;
 import org.apache.hadoop.metrics2.MetricsRecordBuilder;
+import org.apache.yetus.audience.InterfaceAudience;
+
 /**
  * Extended histogram implementation with metric range counters.
  */

http://git-wip-us.apache.org/repos/asf/hbase/blob/26e54e42/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableSizeHistogram.java
----------------------------------------------------------------------
diff --git 
a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableSizeHistogram.java
 
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableSizeHistogram.java
index 7727652..2f1dc6f 100644
--- 
a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableSizeHistogram.java
+++ 
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableSizeHistogram.java
@@ -18,8 +18,8 @@
 
 package org.apache.hadoop.metrics2.lib;
 
-import org.apache.yetus.audience.InterfaceAudience;
 import org.apache.hadoop.metrics2.MetricsInfo;
+import org.apache.yetus.audience.InterfaceAudience;
 
 /**
  * Extended histogram implementation with counters for metric size ranges.

http://git-wip-us.apache.org/repos/asf/hbase/blob/26e54e42/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableTimeHistogram.java
----------------------------------------------------------------------
diff --git 
a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableTimeHistogram.java
 
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableTimeHistogram.java
index f41fe02..e002781 100644
--- 
a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableTimeHistogram.java
+++ 
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableTimeHistogram.java
@@ -18,8 +18,8 @@
 
 package org.apache.hadoop.metrics2.lib;
 
-import org.apache.yetus.audience.InterfaceAudience;
 import org.apache.hadoop.metrics2.MetricsInfo;
+import org.apache.yetus.audience.InterfaceAudience;
 
 /**
  * Extended histogram implementation with counters for metric time ranges.
@@ -28,7 +28,7 @@ import org.apache.hadoop.metrics2.MetricsInfo;
 public class MutableTimeHistogram extends MutableRangeHistogram {
   private final static String RANGE_TYPE = "TimeRangeCount";
   private final static long[] RANGES =
-      { 1, 3, 10, 30, 100, 300, 1000, 3000, 10000, 30000, 60000, 120000, 
300000, 600000 };
+    { 1, 3, 10, 30, 100, 300, 1000, 3000, 10000, 30000, 60000, 120000, 300000, 
600000 };
 
   public MutableTimeHistogram(MetricsInfo info) {
     this(info.name(), info.description());

http://git-wip-us.apache.org/repos/asf/hbase/blob/26e54e42/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/util/MetricQuantile.java
----------------------------------------------------------------------
diff --git 
a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/util/MetricQuantile.java
 
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/util/MetricQuantile.java
index 6d34f70..84a76ed 100644
--- 
a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/util/MetricQuantile.java
+++ 
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/util/MetricQuantile.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -15,7 +15,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.hadoop.metrics2.util;
 
 import org.apache.yetus.audience.InterfaceAudience;
@@ -26,8 +25,14 @@ import org.apache.yetus.audience.InterfaceAudience;
  */
 @InterfaceAudience.Private
 public class MetricQuantile {
-  public final double quantile;
-  public final double error;
+  /**
+   * The quantile to be watched by a {@link MetricSampleQuantiles}.
+   */
+  final double quantile;
+  /**
+   * The error bounds for the {@link #quantile}.
+   */
+  final double error;
 
   public MetricQuantile(double quantile, double error) {
     this.quantile = quantile;

http://git-wip-us.apache.org/repos/asf/hbase/blob/26e54e42/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/util/MetricSampleQuantiles.java
----------------------------------------------------------------------
diff --git 
a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/util/MetricSampleQuantiles.java
 
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/util/MetricSampleQuantiles.java
index 860f260..8d07558 100644
--- 
a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/util/MetricSampleQuantiles.java
+++ 
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/util/MetricSampleQuantiles.java
@@ -69,7 +69,7 @@ public class MetricSampleQuantiles {
   /**
    * Array of Quantiles that we care about, along with desired error.
    */
-  private final MetricQuantile quantiles[];
+  private final MetricQuantile[] quantiles;
 
   public MetricSampleQuantiles(MetricQuantile[] quantiles) {
     this.quantiles = Arrays.copyOf(quantiles, quantiles.length);
@@ -107,7 +107,7 @@ public class MetricSampleQuantiles {
   /**
    * Add a new value from the stream.
    * 
-   * @param v
+   * @param v the value to insert
    */
   synchronized public void insert(long v) {
     buffer[bufferCount] = v;
@@ -280,7 +280,7 @@ public class MetricSampleQuantiles {
     /**
      * Value of the sampled item (e.g. a measured latency value)
      */
-    public final long value;
+    private final long value;
     
     /**
      * Difference between the lowest possible rank of the previous item, and 
@@ -288,13 +288,13 @@ public class MetricSampleQuantiles {
      * 
      * The sum of the g of all previous items yields this item's lower bound. 
      */
-    public int g;
+    private int g;
     
     /**
      * Difference between the item's greatest possible rank and lowest possible
      * rank.
      */
-    public final int delta;
+    private final int delta;
 
     public SampleItem(long value, int lowerDelta, int delta) {
       this.value = value;

http://git-wip-us.apache.org/repos/asf/hbase/blob/26e54e42/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/HadoopShimsImpl.java
----------------------------------------------------------------------
diff --git 
a/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/HadoopShimsImpl.java
 
b/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/HadoopShimsImpl.java
index ce142e8..a022ef3 100644
--- 
a/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/HadoopShimsImpl.java
+++ 
b/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/HadoopShimsImpl.java
@@ -26,12 +26,11 @@ import 
org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl;
  * Compatibility shim layer implementation for Hadoop-2.
  */
 public class HadoopShimsImpl implements HadoopShims {
-
   /**
    * Returns a TaskAttemptContext instance created from the given parameters.
    * @param job an instance of o.a.h.mapreduce.Job
    * @param taskId an identifier for the task attempt id. Should be parsable by
-   * TaskAttemptId.forName()
+   *               {@link TaskAttemptID#forName(String)}
    * @return a concrete TaskAttemptContext instance of 
o.a.h.mapreduce.TaskAttemptContext
    */
   @Override

http://git-wip-us.apache.org/repos/asf/hbase/blob/26e54e42/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/master/TestMetricsMasterSourceImpl.java
----------------------------------------------------------------------
diff --git 
a/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/master/TestMetricsMasterSourceImpl.java
 
b/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/master/TestMetricsMasterSourceImpl.java
index 3434263..70ec90a 100644
--- 
a/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/master/TestMetricsMasterSourceImpl.java
+++ 
b/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/master/TestMetricsMasterSourceImpl.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -33,18 +33,17 @@ import org.junit.experimental.categories.Category;
  */
 @Category({MetricsTests.class, SmallTests.class})
 public class TestMetricsMasterSourceImpl {
-
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
       HBaseClassTestRule.forClass(TestMetricsMasterSourceImpl.class);
 
   @Test
-  public void testGetInstance() throws Exception {
+  public void testGetInstance() {
     MetricsMasterSourceFactory metricsMasterSourceFactory = 
CompatibilitySingletonFactory
         .getInstance(MetricsMasterSourceFactory.class);
     MetricsMasterSource masterSource = metricsMasterSourceFactory.create(null);
     assertTrue(masterSource instanceof MetricsMasterSourceImpl);
-    assertSame(metricsMasterSourceFactory, 
CompatibilitySingletonFactory.getInstance(MetricsMasterSourceFactory.class));
+    assertSame(metricsMasterSourceFactory, 
CompatibilitySingletonFactory.getInstance(
+            MetricsMasterSourceFactory.class));
   }
-
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/26e54e42/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsRegionServerSourceImpl.java
----------------------------------------------------------------------
diff --git 
a/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsRegionServerSourceImpl.java
 
b/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsRegionServerSourceImpl.java
index f970bad..86a94ba 100644
--- 
a/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsRegionServerSourceImpl.java
+++ 
b/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsRegionServerSourceImpl.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -28,18 +28,14 @@ import org.junit.ClassRule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-/**
- *  Test for MetricsRegionServerSourceImpl
- */
 @Category({MetricsTests.class, SmallTests.class})
 public class TestMetricsRegionServerSourceImpl {
-
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
       HBaseClassTestRule.forClass(TestMetricsRegionServerSourceImpl.class);
 
   @Test
-  public void testGetInstance() throws Exception {
+  public void testGetInstance() {
     MetricsRegionServerSourceFactory metricsRegionServerSourceFactory =
         
CompatibilitySingletonFactory.getInstance(MetricsRegionServerSourceFactory.class);
     MetricsRegionServerSource serverSource =
@@ -51,7 +47,7 @@ public class TestMetricsRegionServerSourceImpl {
 
 
   @Test(expected = RuntimeException.class)
-  public void testNoGetRegionServerMetricsSourceImpl() throws Exception {
+  public void testNoGetRegionServerMetricsSourceImpl() {
     // This should throw an exception because MetricsRegionServerSourceImpl 
should only
     // be created by a factory.
     
CompatibilitySingletonFactory.getInstance(MetricsRegionServerSourceImpl.class);

http://git-wip-us.apache.org/repos/asf/hbase/blob/26e54e42/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsRegionSourceImpl.java
----------------------------------------------------------------------
diff --git 
a/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsRegionSourceImpl.java
 
b/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsRegionSourceImpl.java
index 30ea906..a22c7a5 100644
--- 
a/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsRegionSourceImpl.java
+++ 
b/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsRegionSourceImpl.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -19,7 +19,6 @@ package org.apache.hadoop.hbase.regionserver;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertTrue;
 
 import org.apache.hadoop.hbase.CompatibilitySingletonFactory;
 import org.apache.hadoop.hbase.HBaseClassTestRule;
@@ -31,15 +30,15 @@ import org.junit.experimental.categories.Category;
 
 @Category({MetricsTests.class, SmallTests.class})
 public class TestMetricsRegionSourceImpl {
-
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
       HBaseClassTestRule.forClass(TestMetricsRegionSourceImpl.class);
 
   @SuppressWarnings("SelfComparison")
   @Test
-  public void testCompareToHashCodeEquals() throws Exception {
-    MetricsRegionServerSourceFactory fact = 
CompatibilitySingletonFactory.getInstance(MetricsRegionServerSourceFactory.class);
+  public void testCompareToHashCodeEquals() {
+    MetricsRegionServerSourceFactory fact = 
CompatibilitySingletonFactory.getInstance(
+            MetricsRegionServerSourceFactory.class);
 
     MetricsRegionSource one = fact.createRegion(new RegionWrapperStub("TEST"));
     MetricsRegionSource oneClone = fact.createRegion(new 
RegionWrapperStub("TEST"));
@@ -49,15 +48,14 @@ public class TestMetricsRegionSourceImpl {
     assertEquals(one.hashCode(), oneClone.hashCode());
     assertNotEquals(one, two);
 
-    assertTrue( one.compareTo(two) != 0);
-    assertTrue( two.compareTo(one) != 0);
-    assertTrue( two.compareTo(one) != one.compareTo(two));
-    assertTrue( two.compareTo(two) == 0);
+    assertNotEquals(0, one.compareTo(two));
+    assertNotEquals(0, two.compareTo(one));
+    assertNotEquals(one.compareTo(two), two.compareTo(one));
+    assertEquals(0, two.compareTo(two));
   }
 
-
   @Test(expected = RuntimeException.class)
-  public void testNoGetRegionServerMetricsSourceImpl() throws Exception {
+  public void testNoGetRegionServerMetricsSourceImpl() {
     // This should throw an exception because MetricsRegionSourceImpl should 
only
     // be created by a factory.
     CompatibilitySingletonFactory.getInstance(MetricsRegionSource.class);
@@ -67,7 +65,7 @@ public class TestMetricsRegionSourceImpl {
 
     private String regionName;
 
-    public RegionWrapperStub(String regionName) {
+    RegionWrapperStub(String regionName) {
       this.regionName = regionName;
     }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/26e54e42/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsTableSourceImpl.java
----------------------------------------------------------------------
diff --git 
a/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsTableSourceImpl.java
 
b/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsTableSourceImpl.java
index 970a7cc..25fe532 100644
--- 
a/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsTableSourceImpl.java
+++ 
b/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsTableSourceImpl.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -34,7 +34,6 @@ import org.junit.experimental.categories.Category;
  */
 @Category({MetricsTests.class, SmallTests.class})
 public class TestMetricsTableSourceImpl {
-
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
       HBaseClassTestRule.forClass(TestMetricsTableSourceImpl.class);
@@ -46,7 +45,8 @@ public class TestMetricsTableSourceImpl {
         
CompatibilitySingletonFactory.getInstance(MetricsRegionServerSourceFactory.class);
 
     MetricsTableSource one = metricsFact.createTable("ONETABLE", new 
TableWrapperStub("ONETABLE"));
-    MetricsTableSource oneClone = metricsFact.createTable("ONETABLE", new 
TableWrapperStub("ONETABLE"));
+    MetricsTableSource oneClone = metricsFact.createTable("ONETABLE",
+            new TableWrapperStub("ONETABLE"));
     MetricsTableSource two = metricsFact.createTable("TWOTABLE", new 
TableWrapperStub("TWOTABLE"));
 
     assertEquals(0, one.compareTo(oneClone));
@@ -60,14 +60,14 @@ public class TestMetricsTableSourceImpl {
   }
 
   @Test(expected = RuntimeException.class)
-  public void testNoGetTableMetricsSourceImpl() throws Exception {
+  public void testNoGetTableMetricsSourceImpl() {
     // This should throw an exception because MetricsTableSourceImpl should 
only
     // be created by a factory.
     CompatibilitySingletonFactory.getInstance(MetricsTableSourceImpl.class);
   }
 
   @Test
-  public void testGetTableMetrics() throws Exception{
+  public void testGetTableMetrics() {
     MetricsTableSource oneTbl =
         
CompatibilitySingletonFactory.getInstance(MetricsRegionServerSourceFactory.class)
         .createTable("ONETABLE", new TableWrapperStub("ONETABLE"));
@@ -75,7 +75,6 @@ public class TestMetricsTableSourceImpl {
   }
 
   static class TableWrapperStub implements MetricsTableWrapperAggregate {
-
     private String tableName;
 
     public TableWrapperStub(String tableName) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/26e54e42/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestMetricsReplicationSourceFactoryImpl.java
----------------------------------------------------------------------
diff --git 
a/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestMetricsReplicationSourceFactoryImpl.java
 
b/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestMetricsReplicationSourceFactoryImpl.java
index bd23b0e..6cc26e2 100644
--- 
a/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestMetricsReplicationSourceFactoryImpl.java
+++ 
b/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestMetricsReplicationSourceFactoryImpl.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -17,7 +17,7 @@
  */
 package org.apache.hadoop.hbase.replication.regionserver;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertTrue;
 
 import org.apache.hadoop.hbase.CompatibilitySingletonFactory;
 import org.apache.hadoop.hbase.HBaseClassTestRule;
@@ -29,17 +29,14 @@ import org.junit.experimental.categories.Category;
 
 @Category({MetricsTests.class, SmallTests.class})
 public class TestMetricsReplicationSourceFactoryImpl {
-
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
       
HBaseClassTestRule.forClass(TestMetricsReplicationSourceFactoryImpl.class);
 
-
   @Test
-  public void testGetInstance() throws Exception {
+  public void testGetInstance() {
     MetricsReplicationSourceFactory rms = CompatibilitySingletonFactory
         .getInstance(MetricsReplicationSourceFactory.class);
     assertTrue(rms instanceof MetricsReplicationSourceFactoryImpl);
   }
-
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/26e54e42/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestMetricsReplicationSourceImpl.java
----------------------------------------------------------------------
diff --git 
a/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestMetricsReplicationSourceImpl.java
 
b/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestMetricsReplicationSourceImpl.java
index 6751307..faff4b3 100644
--- 
a/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestMetricsReplicationSourceImpl.java
+++ 
b/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestMetricsReplicationSourceImpl.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -21,8 +21,6 @@ import static org.junit.Assert.assertTrue;
 
 import org.apache.hadoop.hbase.CompatibilitySingletonFactory;
 import org.apache.hadoop.hbase.HBaseClassTestRule;
-import 
org.apache.hadoop.hbase.replication.regionserver.MetricsReplicationSource;
-import 
org.apache.hadoop.hbase.replication.regionserver.MetricsReplicationSourceImpl;
 import org.apache.hadoop.hbase.testclassification.MetricsTests;
 import org.apache.hadoop.hbase.testclassification.SmallTests;
 import org.junit.ClassRule;
@@ -30,9 +28,7 @@ import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 @Category({MetricsTests.class, SmallTests.class})
-/** Test for MetricsReplicationSourceImpl */
 public class TestMetricsReplicationSourceImpl {
-
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
       HBaseClassTestRule.forClass(TestMetricsReplicationSourceImpl.class);

http://git-wip-us.apache.org/repos/asf/hbase/blob/26e54e42/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/rest/TestMetricsRESTSourceImpl.java
----------------------------------------------------------------------
diff --git 
a/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/rest/TestMetricsRESTSourceImpl.java
 
b/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/rest/TestMetricsRESTSourceImpl.java
index e41156b..2ac7996 100644
--- 
a/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/rest/TestMetricsRESTSourceImpl.java
+++ 
b/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/rest/TestMetricsRESTSourceImpl.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -22,8 +22,6 @@ import static org.junit.Assert.assertTrue;
 
 import org.apache.hadoop.hbase.CompatibilitySingletonFactory;
 import org.apache.hadoop.hbase.HBaseClassTestRule;
-import org.apache.hadoop.hbase.rest.MetricsRESTSource;
-import org.apache.hadoop.hbase.rest.MetricsRESTSourceImpl;
 import org.apache.hadoop.hbase.testclassification.MetricsTests;
 import org.apache.hadoop.hbase.testclassification.SmallTests;
 import org.junit.ClassRule;
@@ -31,19 +29,18 @@ import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 /**
- *   Test for hadoop 2's version of MetricsRESTSource
+ * Test for hadoop 2's version of {@link MetricsRESTSource}.
  */
 @Category({MetricsTests.class, SmallTests.class})
 public class TestMetricsRESTSourceImpl {
-
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
       HBaseClassTestRule.forClass(TestMetricsRESTSourceImpl.class);
 
   @Test
-  public void ensureCompatRegistered() throws Exception {
+  public void ensureCompatRegistered() {
     
assertNotNull(CompatibilitySingletonFactory.getInstance(MetricsRESTSource.class));
-    
assertTrue(CompatibilitySingletonFactory.getInstance(MetricsRESTSource.class) 
instanceof MetricsRESTSourceImpl);
+    
assertTrue(CompatibilitySingletonFactory.getInstance(MetricsRESTSource.class)
+            instanceof MetricsRESTSourceImpl);
   }
-
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/26e54e42/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/test/MetricsAssertHelperImpl.java
----------------------------------------------------------------------
diff --git 
a/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/test/MetricsAssertHelperImpl.java
 
b/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/test/MetricsAssertHelperImpl.java
index 0e739db..afe31f1 100644
--- 
a/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/test/MetricsAssertHelperImpl.java
+++ 
b/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/test/MetricsAssertHelperImpl.java
@@ -18,6 +18,14 @@
 
 package org.apache.hadoop.hbase.test;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
 import org.apache.hadoop.hbase.metrics.BaseSource;
 import org.apache.hadoop.metrics2.AbstractMetric;
 import org.apache.hadoop.metrics2.MetricsCollector;
@@ -27,12 +35,6 @@ import org.apache.hadoop.metrics2.MetricsSource;
 import org.apache.hadoop.metrics2.MetricsTag;
 import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
 
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-
-import static org.junit.Assert.*;
-
 /**
  *  A helper class that will allow tests to get into hadoop2's metrics2 values.
  */

http://git-wip-us.apache.org/repos/asf/hbase/blob/26e54e42/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/thrift/TestMetricsThriftServerSourceFactoryImpl.java
----------------------------------------------------------------------
diff --git 
a/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/thrift/TestMetricsThriftServerSourceFactoryImpl.java
 
b/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/thrift/TestMetricsThriftServerSourceFactoryImpl.java
index 6808e15..7206810 100644
--- 
a/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/thrift/TestMetricsThriftServerSourceFactoryImpl.java
+++ 
b/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/thrift/TestMetricsThriftServerSourceFactoryImpl.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -25,30 +25,29 @@ import 
org.apache.hadoop.hbase.CompatibilitySingletonFactory;
 import org.apache.hadoop.hbase.HBaseClassTestRule;
 import org.apache.hadoop.hbase.testclassification.MetricsTests;
 import org.apache.hadoop.hbase.testclassification.SmallTests;
-import org.apache.hadoop.hbase.thrift.MetricsThriftServerSourceFactory;
-import org.apache.hadoop.hbase.thrift.MetricsThriftServerSourceFactoryImpl;
 import org.junit.ClassRule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 /**
- *   Test for hadoop 2's version of MetricsThriftServerSourceFactory
+ * Test for hadoop 2's version of MetricsThriftServerSourceFactory.
  */
 @Category({MetricsTests.class, SmallTests.class})
 public class TestMetricsThriftServerSourceFactoryImpl {
-
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
       
HBaseClassTestRule.forClass(TestMetricsThriftServerSourceFactoryImpl.class);
 
   @Test
-  public void testCompatabilityRegistered() throws Exception {
-    
assertNotNull(CompatibilitySingletonFactory.getInstance(MetricsThriftServerSourceFactory.class));
-    
assertTrue(CompatibilitySingletonFactory.getInstance(MetricsThriftServerSourceFactory.class)
 instanceof MetricsThriftServerSourceFactoryImpl);
+  public void testCompatabilityRegistered() {
+    assertNotNull(CompatibilitySingletonFactory.getInstance(
+            MetricsThriftServerSourceFactory.class));
+    
assertTrue(CompatibilitySingletonFactory.getInstance(MetricsThriftServerSourceFactory.class)
+            instanceof MetricsThriftServerSourceFactoryImpl);
   }
 
   @Test
-  public void testCreateThriftOneSource() throws Exception {
+  public void testCreateThriftOneSource() {
     //Make sure that the factory gives back a singleton.
     assertSame(new 
MetricsThriftServerSourceFactoryImpl().createThriftOneSource(),
         new MetricsThriftServerSourceFactoryImpl().createThriftOneSource());
@@ -56,7 +55,7 @@ public class TestMetricsThriftServerSourceFactoryImpl {
   }
 
   @Test
-  public void testCreateThriftTwoSource() throws Exception {
+  public void testCreateThriftTwoSource() {
     //Make sure that the factory gives back a singleton.
     assertSame(new 
MetricsThriftServerSourceFactoryImpl().createThriftTwoSource(),
         new MetricsThriftServerSourceFactoryImpl().createThriftTwoSource());

http://git-wip-us.apache.org/repos/asf/hbase/blob/26e54e42/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/zookeeper/TestMetricsZooKeeperSourceImpl.java
----------------------------------------------------------------------
diff --git 
a/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/zookeeper/TestMetricsZooKeeperSourceImpl.java
 
b/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/zookeeper/TestMetricsZooKeeperSourceImpl.java
index 6e2571d..a199a78 100644
--- 
a/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/zookeeper/TestMetricsZooKeeperSourceImpl.java
+++ 
b/hbase-hadoop2-compat/src/test/java/org/apache/hadoop/hbase/zookeeper/TestMetricsZooKeeperSourceImpl.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -30,14 +30,14 @@ import org.junit.experimental.categories.Category;
 
 @Category({MetricsTests.class, SmallTests.class})
 public class TestMetricsZooKeeperSourceImpl {
-
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
       HBaseClassTestRule.forClass(TestMetricsZooKeeperSourceImpl.class);
 
   @Test
-  public void testGetInstance() throws Exception {
-    MetricsZooKeeperSource zkSource = 
CompatibilitySingletonFactory.getInstance(MetricsZooKeeperSource.class);
+  public void testGetInstance() {
+    MetricsZooKeeperSource zkSource =
+            
CompatibilitySingletonFactory.getInstance(MetricsZooKeeperSource.class);
     assertTrue(zkSource instanceof MetricsZooKeeperSourceImpl);
     assertSame(zkSource, 
CompatibilitySingletonFactory.getInstance(MetricsZooKeeperSource.class));
   }

Reply via email to