Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
*/
@InterfaceAudience.Private
public class CompatibilitySingletonFactory extends CompatibilityFactory {

@SuppressWarnings("ImmutableEnumChecker")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a good design but anyway, it works. Not your fault, let's file another issue to rewrite this...

public static enum SingletonStorage {
INSTANCE;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@

@InterfaceAudience.Private
public class MetricsHBaseServerSourceFactoryImpl extends MetricsHBaseServerSourceFactory {

@SuppressWarnings("ImmutableEnumChecker")
private enum SourceStorage {
INSTANCE;

HashMap<String, MetricsHBaseServerSource> sources = new HashMap<>();
private final HashMap<String, MetricsHBaseServerSource> sources = new HashMap<>();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,13 @@
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.
*/
@InterfaceAudience.Private
@InterfaceStability.Evolving
public abstract class JobUtil {
private static final Logger LOG = LoggerFactory.getLogger(JobUtil.class);

protected JobUtil() {
super();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public MetricsAssignmentManagerSourceImpl(String metricsName, String metricsDesc
super(metricsName, metricsDescription, metricsContext, metricsJmxContext);
}

@Override
public void init() {
ritGauge = metricsRegistry.newGauge(RIT_COUNT_NAME, RIT_COUNT_DESC, 0L);
ritCountOverThresholdGauge =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@
*/
@InterfaceAudience.Private
public class MetricsMasterSourceFactoryImpl implements MetricsMasterSourceFactory {

@SuppressWarnings("ImmutableEnumChecker")
private static enum FactoryStorage {
INSTANCE;

MetricsMasterSource masterSource;
private MetricsMasterSource masterSource;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public void updateMetricsSize(int size) {
/**
* 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
@InterfaceAudience.Private
public class BaseSourceImpl implements BaseSource, MetricsSource {

@SuppressWarnings("ImmutableEnumChecker")
private static enum DefaultMetricsSystemInitializer {
INSTANCE;

Expand Down Expand Up @@ -121,6 +122,7 @@ public BaseSourceImpl(String metricsName, String metricsDescription, String metr

}

@Override
public void init() {
this.metricsRegistry.clearMetrics();
}
Expand All @@ -130,6 +132,7 @@ public void init() {
* @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);
Expand All @@ -140,6 +143,7 @@ public void setGauge(String gaugeName, long value) {
* @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);
Expand All @@ -150,6 +154,7 @@ public void incGauge(String gaugeName, long delta) {
* @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);
Expand All @@ -160,6 +165,7 @@ public void decGauge(String gaugeName, long delta) {
* @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);
Expand All @@ -176,6 +182,7 @@ public void updateHistogram(String name, long value) {
* Remove a named gauge.
* @param key the key of the gauge to remove
*/
@Override
public void removeMetric(String key) {
metricsRegistry.removeMetric(key);
JmxCacheBuster.clearJmxCache();
Expand All @@ -190,18 +197,22 @@ public DynamicMetricsRegistry getMetricsRegistry() {
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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ public final class Interns {
private static LoadingCache<String, ConcurrentHashMap<String, MetricsInfo>> infoCache =
CacheBuilder.newBuilder().expireAfterAccess(1, TimeUnit.DAYS)
.build(new CacheLoader<String, ConcurrentHashMap<String, MetricsInfo>>() {
@Override
public ConcurrentHashMap<String, MetricsInfo> load(String key) {
return new ConcurrentHashMap<>();
}
});
private static LoadingCache<MetricsInfo, ConcurrentHashMap<String, MetricsTag>> tagCache =
CacheBuilder.newBuilder().expireAfterAccess(1, TimeUnit.DAYS)
.build(new CacheLoader<MetricsInfo, ConcurrentHashMap<String, MetricsTag>>() {
@Override
public ConcurrentHashMap<String, MetricsTag> load(MetricsInfo key) {
return new ConcurrentHashMap<>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public MetricsRegionAggregateSourceImpl(String metricsName, String metricsDescri

// Every few mins clean the JMX cache.
executor.getExecutor().scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {
JmxCacheBuster.clearJmxCache();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
*/
@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;
Expand All @@ -46,6 +48,7 @@ private synchronized MetricsRegionAggregateSourceImpl getRegionAggregate() {
}
}

@Override
public synchronized MetricsUserAggregateSourceImpl getUserAggregate() {
synchronized (FactoryStorage.INSTANCE.aggLock) {
if (FactoryStorage.INSTANCE.userAggImpl == null) {
Expand Down Expand Up @@ -91,6 +94,7 @@ public MetricsTableSource createTable(String table, MetricsTableWrapperAggregate
return new MetricsTableSourceImpl(table, getTableAggregate(), wrapper);
}

@Override
public MetricsIOSource createIO(MetricsIOWrapper wrapper) {
return new MetricsIOSourceImpl(wrapper);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,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();

Expand All @@ -150,8 +150,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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ public MetricsTableAggregateSourceImpl(String metricsName, String metricsDescrip
super(metricsName, metricsDescription, metricsContext, metricsJmxContext);
}

private void register(MetricsTableSource source) {
source.registerMetrics();
}

@Override
public void deleteTableSource(String table) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@
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 {

Expand Down Expand Up @@ -354,8 +357,9 @@ private void addGauge(MetricsRecordBuilder mrb, Map<String, Long> metricMap, Str
for (Entry<String, Long> 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());
}
}
}
Expand All @@ -375,11 +379,9 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}

if (o == null || getClass() != o.getClass()) {
if (!(o instanceof MetricsTableSourceImpl)) {
return false;
}

return (compareTo((MetricsTableSourceImpl) o) == 0);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, ClientMetrics> clientMetricsMap;
Expand Down Expand Up @@ -115,7 +114,6 @@ public MetricsUserSourceImpl(String user, MetricsUserAggregateSourceImpl agg) {
}

this.user = user;
this.agg = agg;
this.registry = agg.getMetricsRegistry();

this.userNamePrefix = "user_" + user + "_metric_";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
@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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public MetricsZooKeeperSourceImpl(String metricsName, String metricsDescription,
SYNC_OPERATION_LATENCY_DESC);
}

@Override
public void getMetrics(MetricsCollector metricsCollector, boolean all) {
super.getMetrics(metricsCollector, all);
clearZKExceptionMetrics();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class DefaultMetricsSystemHelper {
private final Field mapField;

public DefaultMetricsSystemHelper() {
@SuppressWarnings("GetClassOnEnum")
Class<? extends DefaultMetricsSystem> clazz = DefaultMetricsSystem.INSTANCE.getClass();
Method m;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
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;
Expand All @@ -43,7 +41,6 @@
*/
@InterfaceAudience.Private
public class DynamicMetricsRegistry {
private static final Logger LOG = LoggerFactory.getLogger(DynamicMetricsRegistry.class);

private final ConcurrentMap<String, MutableMetric> metricsMap = Maps.newConcurrentMap();
private final ConcurrentMap<String, MetricsTag> tagsMap = Maps.newConcurrentMap();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public void stop() {
}
}

@SuppressWarnings("ImmutableEnumChecker")
private enum ExecutorSingleton {
INSTANCE;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public MutableHistogram(String name, String description) {
this.histogram = new HistogramImpl();
}

@Override
public void add(final long val) {
histogram.update(val);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
* summaries" in SIGMOD 2001
*/
@InterfaceAudience.Private
@SuppressWarnings("JdkObsolete") // This is a use case for LinkedList
public class MetricSampleQuantiles {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public interface HadoopShims {
* TaskAttemptId.forName()
* @return a concrete TaskAttemptContext instance of o.a.h.mapreduce.TaskAttemptContext
*/
@SuppressWarnings("TypeParameterUnusedInFormals")
<T, J> T createTestTaskAttemptContext(final J job, final String taskId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -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, J> T createTestTaskAttemptContext(J job, String taskId) {
Job j = (Job) job;
return (T) new TaskAttemptContextImpl(j.getConfiguration(), TaskAttemptID.forName(taskId));
Expand Down
Loading