From b17bc94b10d04d4a2a2d398c9f143c364f44b19b Mon Sep 17 00:00:00 2001 From: Andrew Purtell Date: Mon, 25 Jul 2022 17:30:15 -0700 Subject: [PATCH] HBASE-27235 Clean up error-prone warnings in hbase-hadoop-compat (#4648) Signed-off-by: Duo Zhang --- .../hadoop/hbase/CompatibilitySingletonFactory.java | 2 ++ .../hbase/regionserver/MetricsRegionWrapper.java | 12 ++++++------ .../java/org/apache/hadoop/hbase/HadoopShims.java | 1 + .../hbase/TestCompatibilitySingletonFactory.java | 2 +- .../ipc/MetricsHBaseServerSourceFactoryImpl.java | 4 +++- .../org/apache/hadoop/hbase/mapreduce/JobUtil.java | 3 --- .../master/MetricsAssignmentManagerSourceImpl.java | 1 + .../hbase/master/MetricsMasterSourceFactoryImpl.java | 4 +++- .../MetricsStochasticBalancerSourceImpl.java | 1 + .../apache/hadoop/hbase/metrics/BaseSourceImpl.java | 11 +++++++++++ .../org/apache/hadoop/hbase/metrics/Interns.java | 2 ++ .../MetricsRegionAggregateSourceImpl.java | 1 + .../MetricsRegionServerSourceFactoryImpl.java | 6 +++++- .../MetricsTableAggregateSourceImpl.java | 4 ---- .../hbase/regionserver/MetricsTableSourceImpl.java | 12 +++++++----- .../hbase/regionserver/MetricsUserSourceImpl.java | 2 -- .../MetricsReplicationSourceFactoryImpl.java | 3 ++- .../thrift/MetricsThriftServerSourceFactoryImpl.java | 5 +++-- .../hbase/zookeeper/MetricsZooKeeperSourceImpl.java | 1 + .../metrics2/lib/DefaultMetricsSystemHelper.java | 1 + .../hadoop/metrics2/lib/DynamicMetricsRegistry.java | 3 --- .../hadoop/metrics2/lib/MetricsExecutorImpl.java | 1 + .../apache/hadoop/metrics2/lib/MutableHistogram.java | 1 + .../hadoop/metrics2/util/MetricSampleQuantiles.java | 1 + .../org/apache/hadoop/hbase/HadoopShimsImpl.java | 2 +- 25 files changed, 55 insertions(+), 31 deletions(-) diff --git a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/CompatibilitySingletonFactory.java b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/CompatibilitySingletonFactory.java index ccd4d4f97ad..ee9eb14a790 100644 --- a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/CompatibilitySingletonFactory.java +++ b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/CompatibilitySingletonFactory.java @@ -31,6 +31,8 @@ import org.slf4j.LoggerFactory; */ @InterfaceAudience.Private public class CompatibilitySingletonFactory extends CompatibilityFactory { + + @SuppressWarnings("ImmutableEnumChecker") public static enum SingletonStorage { INSTANCE; diff --git a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionWrapper.java b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionWrapper.java index 2782af18b83..3115603aabf 100644 --- a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionWrapper.java +++ b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionWrapper.java @@ -111,14 +111,14 @@ public interface MetricsRegionWrapper { long getNumCompactionsFailed(); /** - * @return the total number of compactions that are currently queued(or being executed) at point - * in time + * Returns the total number of compactions that are currently queued(or being executed) at point + * in time */ long getNumCompactionsQueued(); /** - * @return the total number of flushes currently queued(being executed) for this region at point - * in time + * Returns the total number of flushes currently queued(being executed) for this region at point + * in time */ long getNumFlushesQueued(); @@ -145,8 +145,8 @@ public interface MetricsRegionWrapper { long getStoreRefCount(); /** - * @return the max number of references active on any store file among all compacted store files - * that belong to this region + * Returns the max number of references active on any store file among all compacted store files + * that belong to this region */ long getMaxCompactedStoreFileRefCount(); diff --git a/hbase-hadoop-compat/src/test/java/org/apache/hadoop/hbase/HadoopShims.java b/hbase-hadoop-compat/src/test/java/org/apache/hadoop/hbase/HadoopShims.java index 92442de2b3c..04b0fef9cd4 100644 --- a/hbase-hadoop-compat/src/test/java/org/apache/hadoop/hbase/HadoopShims.java +++ b/hbase-hadoop-compat/src/test/java/org/apache/hadoop/hbase/HadoopShims.java @@ -30,6 +30,7 @@ public interface HadoopShims { * TaskAttemptId.forName() * @return a concrete TaskAttemptContext instance of o.a.h.mapreduce.TaskAttemptContext */ + @SuppressWarnings("TypeParameterUnusedInFormals") T createTestTaskAttemptContext(final J job, final String taskId); } diff --git a/hbase-hadoop-compat/src/test/java/org/apache/hadoop/hbase/TestCompatibilitySingletonFactory.java b/hbase-hadoop-compat/src/test/java/org/apache/hadoop/hbase/TestCompatibilitySingletonFactory.java index e963a439efa..10f11240743 100644 --- a/hbase-hadoop-compat/src/test/java/org/apache/hadoop/hbase/TestCompatibilitySingletonFactory.java +++ b/hbase-hadoop-compat/src/test/java/org/apache/hadoop/hbase/TestCompatibilitySingletonFactory.java @@ -41,7 +41,7 @@ public class TestCompatibilitySingletonFactory { private static final int ITERATIONS = 100000; - private class TestCompatibilitySingletonFactoryCallable implements Callable { + private static class TestCompatibilitySingletonFactoryCallable implements Callable { @Override public String call() throws Exception { diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSourceFactoryImpl.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSourceFactoryImpl.java index bdb87a727a5..8a946383a59 100644 --- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSourceFactoryImpl.java +++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSourceFactoryImpl.java @@ -23,10 +23,12 @@ import org.apache.yetus.audience.InterfaceAudience; @InterfaceAudience.Private public class MetricsHBaseServerSourceFactoryImpl extends MetricsHBaseServerSourceFactory { + + @SuppressWarnings("ImmutableEnumChecker") private enum SourceStorage { INSTANCE; - HashMap sources = new HashMap<>(); + private final HashMap sources = new HashMap<>(); } @Override diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/mapreduce/JobUtil.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/mapreduce/JobUtil.java index f1555f660be..023f8d1ada0 100644 --- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/mapreduce/JobUtil.java +++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/mapreduce/JobUtil.java @@ -24,8 +24,6 @@ import org.apache.hadoop.mapreduce.Cluster; import org.apache.hadoop.mapreduce.JobSubmissionFiles; import org.apache.yetus.audience.InterfaceAudience; import org.apache.yetus.audience.InterfaceStability; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * Utility methods to interact with a job. @@ -33,7 +31,6 @@ import org.slf4j.LoggerFactory; @InterfaceAudience.Private @InterfaceStability.Evolving public abstract class JobUtil { - private static final Logger LOG = LoggerFactory.getLogger(JobUtil.class); protected JobUtil() { super(); diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsAssignmentManagerSourceImpl.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsAssignmentManagerSourceImpl.java index 5d88638df52..5512e906b67 100644 --- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsAssignmentManagerSourceImpl.java +++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsAssignmentManagerSourceImpl.java @@ -66,6 +66,7 @@ public class MetricsAssignmentManagerSourceImpl extends BaseSourceImpl super(metricsName, metricsDescription, metricsContext, metricsJmxContext); } + @Override public void init() { ritGauge = metricsRegistry.newGauge(RIT_COUNT_NAME, RIT_COUNT_DESC, 0L); ritCountOverThresholdGauge = diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsMasterSourceFactoryImpl.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsMasterSourceFactoryImpl.java index 84c49062f03..f13b351d1f9 100644 --- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsMasterSourceFactoryImpl.java +++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/MetricsMasterSourceFactoryImpl.java @@ -24,10 +24,12 @@ import org.apache.yetus.audience.InterfaceAudience; */ @InterfaceAudience.Private public class MetricsMasterSourceFactoryImpl implements MetricsMasterSourceFactory { + + @SuppressWarnings("ImmutableEnumChecker") private static enum FactoryStorage { INSTANCE; - MetricsMasterSource masterSource; + private MetricsMasterSource masterSource; } @Override diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/balancer/MetricsStochasticBalancerSourceImpl.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/balancer/MetricsStochasticBalancerSourceImpl.java index 358e4a79515..1d770b5bdef 100644 --- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/balancer/MetricsStochasticBalancerSourceImpl.java +++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/master/balancer/MetricsStochasticBalancerSourceImpl.java @@ -64,6 +64,7 @@ public class MetricsStochasticBalancerSourceImpl extends MetricsBalancerSourceIm /** * Reports stochastic load balancer costs to JMX */ + @Override public void updateStochasticCost(String tableName, String costFunctionName, String functionDesc, Double cost) { if (tableName == null || costFunctionName == null || cost == null) { diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/metrics/BaseSourceImpl.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/metrics/BaseSourceImpl.java index 9f11ff97128..2db502deb15 100644 --- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/metrics/BaseSourceImpl.java +++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/metrics/BaseSourceImpl.java @@ -39,6 +39,7 @@ import org.apache.yetus.audience.InterfaceAudience; @InterfaceAudience.Private public class BaseSourceImpl implements BaseSource, MetricsSource { + @SuppressWarnings("ImmutableEnumChecker") private static enum DefaultMetricsSystemInitializer { INSTANCE; @@ -121,6 +122,7 @@ public class BaseSourceImpl implements BaseSource, MetricsSource { } + @Override public void init() { this.metricsRegistry.clearMetrics(); } @@ -130,6 +132,7 @@ public class BaseSourceImpl implements BaseSource, MetricsSource { * @param gaugeName gauge name * @param value the new value of the gauge. */ + @Override public void setGauge(String gaugeName, long value) { MutableGaugeLong gaugeInt = metricsRegistry.getGauge(gaugeName, value); gaugeInt.set(value); @@ -140,6 +143,7 @@ public class BaseSourceImpl implements BaseSource, MetricsSource { * @param gaugeName The name of the gauge to increment. * @param delta The amount to increment the gauge by. */ + @Override public void incGauge(String gaugeName, long delta) { MutableGaugeLong gaugeInt = metricsRegistry.getGauge(gaugeName, 0L); gaugeInt.incr(delta); @@ -150,6 +154,7 @@ public class BaseSourceImpl implements BaseSource, MetricsSource { * @param gaugeName The name of the gauge. * @param delta the ammount to subtract from a gauge value. */ + @Override public void decGauge(String gaugeName, long delta) { MutableGaugeLong gaugeInt = metricsRegistry.getGauge(gaugeName, 0L); gaugeInt.decr(delta); @@ -160,6 +165,7 @@ public class BaseSourceImpl implements BaseSource, MetricsSource { * @param key the name of the counter * @param delta the ammount to increment */ + @Override public void incCounters(String key, long delta) { MutableFastCounter counter = metricsRegistry.getCounter(key, 0L); counter.incr(delta); @@ -176,6 +182,7 @@ public class BaseSourceImpl implements BaseSource, MetricsSource { * Remove a named gauge. * @param key the key of the gauge to remove */ + @Override public void removeMetric(String key) { metricsRegistry.removeMetric(key); JmxCacheBuster.clearJmxCache(); @@ -190,18 +197,22 @@ public class BaseSourceImpl implements BaseSource, MetricsSource { return metricsRegistry; } + @Override public String getMetricsContext() { return metricsContext; } + @Override public String getMetricsDescription() { return metricsDescription; } + @Override public String getMetricsJmxContext() { return metricsJmxContext; } + @Override public String getMetricsName() { return metricsName; } diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/metrics/Interns.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/metrics/Interns.java index 5952a60a0a5..2a455973255 100644 --- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/metrics/Interns.java +++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/metrics/Interns.java @@ -39,6 +39,7 @@ public final class Interns { private static LoadingCache> infoCache = CacheBuilder.newBuilder().expireAfterAccess(1, TimeUnit.DAYS) .build(new CacheLoader>() { + @Override public ConcurrentHashMap load(String key) { return new ConcurrentHashMap<>(); } @@ -46,6 +47,7 @@ public final class Interns { private static LoadingCache> tagCache = CacheBuilder.newBuilder().expireAfterAccess(1, TimeUnit.DAYS) .build(new CacheLoader>() { + @Override public ConcurrentHashMap load(MetricsInfo key) { return new ConcurrentHashMap<>(); } diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionAggregateSourceImpl.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionAggregateSourceImpl.java index a1f46182c17..368eb5eb60b 100644 --- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionAggregateSourceImpl.java +++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionAggregateSourceImpl.java @@ -51,6 +51,7 @@ public class MetricsRegionAggregateSourceImpl extends BaseSourceImpl // Every few mins clean the JMX cache. executor.getExecutor().scheduleWithFixedDelay(new Runnable() { + @Override public void run() { JmxCacheBuster.clearJmxCache(); } diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSourceFactoryImpl.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSourceFactoryImpl.java index c2a5e163f0f..f653788fcfc 100644 --- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSourceFactoryImpl.java +++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSourceFactoryImpl.java @@ -27,10 +27,12 @@ import org.apache.yetus.audience.InterfaceAudience; */ @InterfaceAudience.Private public class MetricsRegionServerSourceFactoryImpl implements MetricsRegionServerSourceFactory { + + @SuppressWarnings("ImmutableEnumChecker") public static enum FactoryStorage { INSTANCE; - private Object aggLock = new Object(); + private final Object aggLock = new Object(); private MetricsRegionAggregateSourceImpl regionAggImpl; private MetricsUserAggregateSourceImpl userAggImpl; private MetricsTableAggregateSourceImpl tblAggImpl; @@ -46,6 +48,7 @@ public class MetricsRegionServerSourceFactoryImpl implements MetricsRegionServer } } + @Override public synchronized MetricsUserAggregateSourceImpl getUserAggregate() { synchronized (FactoryStorage.INSTANCE.aggLock) { if (FactoryStorage.INSTANCE.userAggImpl == null) { @@ -91,6 +94,7 @@ public class MetricsRegionServerSourceFactoryImpl implements MetricsRegionServer return new MetricsTableSourceImpl(table, getTableAggregate(), wrapper); } + @Override public MetricsIOSource createIO(MetricsIOWrapper wrapper) { return new MetricsIOSourceImpl(wrapper); } diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsTableAggregateSourceImpl.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsTableAggregateSourceImpl.java index 9b36d27b99d..2fa3c2142a6 100644 --- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsTableAggregateSourceImpl.java +++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsTableAggregateSourceImpl.java @@ -43,10 +43,6 @@ public class MetricsTableAggregateSourceImpl extends BaseSourceImpl super(metricsName, metricsDescription, metricsContext, metricsJmxContext); } - private void register(MetricsTableSource source) { - source.registerMetrics(); - } - @Override public void deleteTableSource(String table) { try { diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsTableSourceImpl.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsTableSourceImpl.java index afc4310fb69..f7d0068bd81 100644 --- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsTableSourceImpl.java +++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsTableSourceImpl.java @@ -74,6 +74,9 @@ import org.apache.yetus.audience.InterfaceAudience; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.apache.hbase.thirdparty.com.google.common.base.Splitter; +import org.apache.hbase.thirdparty.com.google.common.collect.Iterables; + @InterfaceAudience.Private public class MetricsTableSourceImpl implements MetricsTableSource { @@ -350,8 +353,9 @@ public class MetricsTableSourceImpl implements MetricsTableSource { for (Entry entry : metricMap.entrySet()) { // append 'store' and its name to the metric mrb.addGauge(Interns.info(this.tableNamePrefixPart1 + _COLUMNFAMILY - + entry.getKey().split(MetricsTableWrapperAggregate.HASH)[1] + this.tableNamePrefixPart2 - + metricName, metricDesc), entry.getValue()); + + Iterables + .get(Splitter.onPattern(MetricsTableWrapperAggregate.HASH).split(entry.getKey()), 1) + + this.tableNamePrefixPart2 + metricName, metricDesc), entry.getValue()); } } } @@ -371,11 +375,9 @@ public class MetricsTableSourceImpl implements MetricsTableSource { if (this == o) { return true; } - - if (o == null || getClass() != o.getClass()) { + if (!(o instanceof MetricsTableSourceImpl)) { return false; } - return (compareTo((MetricsTableSourceImpl) o) == 0); } diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsUserSourceImpl.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsUserSourceImpl.java index 8559e0e4b92..95cb3623954 100644 --- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsUserSourceImpl.java +++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsUserSourceImpl.java @@ -57,7 +57,6 @@ public class MetricsUserSourceImpl implements MetricsUserSource { private final int hashCode; private AtomicBoolean closed = new AtomicBoolean(false); - private final MetricsUserAggregateSourceImpl agg; private final DynamicMetricsRegistry registry; private ConcurrentHashMap clientMetricsMap; @@ -115,7 +114,6 @@ public class MetricsUserSourceImpl implements MetricsUserSource { } this.user = user; - this.agg = agg; this.registry = agg.getMetricsRegistry(); this.userNamePrefix = "user_" + user + "_metric_"; diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsReplicationSourceFactoryImpl.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsReplicationSourceFactoryImpl.java index 5b223b42392..fcfaa0bfa8d 100644 --- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsReplicationSourceFactoryImpl.java +++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsReplicationSourceFactoryImpl.java @@ -22,10 +22,11 @@ import org.apache.yetus.audience.InterfaceAudience; @InterfaceAudience.Private public class MetricsReplicationSourceFactoryImpl implements MetricsReplicationSourceFactory { + @SuppressWarnings("ImmutableEnumChecker") private static enum SourceHolder { INSTANCE; - final MetricsReplicationSourceImpl source = new MetricsReplicationSourceImpl(); + private final MetricsReplicationSourceImpl source = new MetricsReplicationSourceImpl(); } @Override diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/thrift/MetricsThriftServerSourceFactoryImpl.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/thrift/MetricsThriftServerSourceFactoryImpl.java index 0ad71fc46c4..6921f278865 100644 --- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/thrift/MetricsThriftServerSourceFactoryImpl.java +++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/thrift/MetricsThriftServerSourceFactoryImpl.java @@ -29,11 +29,12 @@ public class MetricsThriftServerSourceFactoryImpl implements MetricsThriftServer * A singleton used to make sure that only one thrift metrics source per server type is ever * created. */ + @SuppressWarnings("ImmutableEnumChecker") private enum FactoryStorage { INSTANCE; - MetricsThriftServerSourceImpl thriftOne; - MetricsThriftServerSourceImpl thriftTwo; + private MetricsThriftServerSourceImpl thriftOne; + private MetricsThriftServerSourceImpl thriftTwo; } @Override diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/zookeeper/MetricsZooKeeperSourceImpl.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/zookeeper/MetricsZooKeeperSourceImpl.java index 9429428d300..3f3aa3a9ea5 100644 --- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/zookeeper/MetricsZooKeeperSourceImpl.java +++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/zookeeper/MetricsZooKeeperSourceImpl.java @@ -83,6 +83,7 @@ public class MetricsZooKeeperSourceImpl extends BaseSourceImpl implements Metric SYNC_OPERATION_LATENCY_DESC); } + @Override public void getMetrics(MetricsCollector metricsCollector, boolean all) { super.getMetrics(metricsCollector, all); clearZKExceptionMetrics(); 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 09556707648..a9c530f382a 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 @@ -33,6 +33,7 @@ public class DefaultMetricsSystemHelper { private final Field mapField; public DefaultMetricsSystemHelper() { + @SuppressWarnings("GetClassOnEnum") Class clazz = DefaultMetricsSystem.INSTANCE.getClass(); Method m; try { 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 f1b1196cea4..f2666cf692f 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 @@ -26,8 +26,6 @@ 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; @@ -43,7 +41,6 @@ import org.apache.hbase.thirdparty.com.google.common.collect.Maps; */ @InterfaceAudience.Private public class DynamicMetricsRegistry { - private static final Logger LOG = LoggerFactory.getLogger(DynamicMetricsRegistry.class); private final ConcurrentMap metricsMap = Maps.newConcurrentMap(); private final ConcurrentMap tagsMap = Maps.newConcurrentMap(); 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 1b4d9ecc8f1..1d4703f5943 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 @@ -43,6 +43,7 @@ public class MetricsExecutorImpl implements MetricsExecutor { } } + @SuppressWarnings("ImmutableEnumChecker") private enum ExecutorSingleton { INSTANCE; 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 d5356aecda3..df38b6ba33e 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 @@ -46,6 +46,7 @@ public class MutableHistogram extends MutableMetric implements MetricHistogram { this.histogram = new HistogramImpl(); } + @Override public void add(final long val) { histogram.update(val); } 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 cf01b099bb8..f2d3f63dbcb 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 @@ -35,6 +35,7 @@ import org.apache.yetus.audience.InterfaceAudience; * summaries" in SIGMOD 2001 */ @InterfaceAudience.Private +@SuppressWarnings("JdkObsolete") // This is a use case for LinkedList public class MetricSampleQuantiles { /** 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 533d2d6d104..b12990eb9cf 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 @@ -33,7 +33,7 @@ public class HadoopShimsImpl implements HadoopShims { * @return a concrete TaskAttemptContext instance of o.a.h.mapreduce.TaskAttemptContext */ @Override - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "TypeParameterUnusedInFormals" }) public T createTestTaskAttemptContext(J job, String taskId) { Job j = (Job) job; return (T) new TaskAttemptContextImpl(j.getConfiguration(), TaskAttemptID.forName(taskId));