hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gxch...@apache.org
Subject hbase git commit: HBASE-20396 Remove redundant metrics from thrift metrics
Date Mon, 09 Jul 2018 03:46:34 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 3bca01854 -> 6df7f2346


HBASE-20396 Remove redundant metrics from thrift metrics


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/6df7f234
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/6df7f234
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/6df7f234

Branch: refs/heads/master
Commit: 6df7f2346ca75fe46f95427680aea32aba768cc7
Parents: 3bca018
Author: Guangxu Cheng <guangxucheng@gmail.com>
Authored: Thu Apr 12 17:40:57 2018 +0800
Committer: Guangxu Cheng <guangxucheng@gmail.com>
Committed: Mon Jul 9 10:33:36 2018 +0800

----------------------------------------------------------------------
 .../MetricsThriftServerSourceFactoryImpl.java   | 24 ++++++++++++--------
 1 file changed, 15 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/6df7f234/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/thrift/MetricsThriftServerSourceFactoryImpl.java
----------------------------------------------------------------------
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 002985a..3ce2d5d 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
@@ -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;
   }
 }


Mime
View raw message