HBASE-20396 Remove redundant metrics from thrift metrics

This commit is contained in:
Guangxu Cheng 2018-04-12 17:40:57 +08:00
parent 3bca01854a
commit 6df7f2346c
1 changed files with 15 additions and 9 deletions

View File

@ -30,25 +30,31 @@ public class MetricsThriftServerSourceFactoryImpl implements MetricsThriftServer
* A singleton used to make sure that only one thrift metrics source per server type is ever
* created.
*/
private static enum FactoryStorage {
private enum FactoryStorage {
INSTANCE;
MetricsThriftServerSourceImpl thriftOne = new MetricsThriftServerSourceImpl(METRICS_NAME,
METRICS_DESCRIPTION,
THRIFT_ONE_METRICS_CONTEXT,
THRIFT_ONE_JMX_CONTEXT);
MetricsThriftServerSourceImpl thriftTwo = new MetricsThriftServerSourceImpl(METRICS_NAME,
METRICS_DESCRIPTION,
THRIFT_TWO_METRICS_CONTEXT,
THRIFT_TWO_JMX_CONTEXT);
MetricsThriftServerSourceImpl thriftOne;
MetricsThriftServerSourceImpl thriftTwo;
}
@Override
public MetricsThriftServerSource createThriftOneSource() {
if (FactoryStorage.INSTANCE.thriftOne == null) {
FactoryStorage.INSTANCE.thriftOne = new MetricsThriftServerSourceImpl(METRICS_NAME,
METRICS_DESCRIPTION,
THRIFT_ONE_METRICS_CONTEXT,
THRIFT_ONE_JMX_CONTEXT);
}
return FactoryStorage.INSTANCE.thriftOne;
}
@Override
public MetricsThriftServerSource createThriftTwoSource() {
if (FactoryStorage.INSTANCE.thriftTwo == null) {
FactoryStorage.INSTANCE.thriftTwo = new MetricsThriftServerSourceImpl(METRICS_NAME,
METRICS_DESCRIPTION,
THRIFT_TWO_METRICS_CONTEXT,
THRIFT_TWO_JMX_CONTEXT);
}
return FactoryStorage.INSTANCE.thriftTwo;
}
}