hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jl...@apache.org
Subject hadoop git commit: HADOOP-14891. Remove references to Guava Objects.toStringHelper. Contributed by Jonathan Eagles
Date Tue, 26 Sep 2017 15:13:12 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 c27f68203 -> 0aac5af6e


HADOOP-14891. Remove references to Guava Objects.toStringHelper. Contributed by Jonathan Eagles


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/0aac5af6
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/0aac5af6
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/0aac5af6

Branch: refs/heads/branch-2
Commit: 0aac5af6e1a2b265cc8faa99b386276ed14faeda
Parents: c27f682
Author: Jason Lowe <jlowe@apache.org>
Authored: Tue Sep 26 10:08:06 2017 -0500
Committer: Jason Lowe <jlowe@apache.org>
Committed: Tue Sep 26 10:08:06 2017 -0500

----------------------------------------------------------------------
 .../apache/hadoop/metrics2/AbstractMetric.java  | 11 +++++++----
 .../org/apache/hadoop/metrics2/MetricsTag.java  | 11 +++++++----
 .../metrics2/impl/AbstractMetricsRecord.java    | 20 +++++++++++++-------
 .../org/apache/hadoop/metrics2/impl/MsInfo.java | 12 +++++++-----
 .../hadoop/metrics2/lib/MetricsInfoImpl.java    | 10 +++++++---
 .../hadoop/metrics2/lib/MetricsRegistry.java    | 13 +++++++++----
 .../hadoop/metrics2/source/JvmMetricsInfo.java  | 12 +++++++-----
 .../hadoop/metrics2/util/MetricsCache.java      | 11 +++++++----
 8 files changed, 64 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/0aac5af6/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/AbstractMetric.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/AbstractMetric.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/AbstractMetric.java
index 6a11b87..510cee0 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/AbstractMetric.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/AbstractMetric.java
@@ -84,9 +84,12 @@ public abstract class AbstractMetric implements MetricsInfo {
   }
 
   @Override public String toString() {
-    return Objects.toStringHelper(this)
-        .add("info", info)
-        .add("value", value())
-        .toString();
+    StringBuilder sb = new StringBuilder(32);
+    sb.append(this.getClass().getSimpleName());
+    sb.append("{info=");
+    sb.append(info);
+    sb.append(", value=");
+    sb.append(value());
+    return sb.append('}').toString();
   }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/0aac5af6/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/MetricsTag.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/MetricsTag.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/MetricsTag.java
index e9e50a4..23ef086 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/MetricsTag.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/MetricsTag.java
@@ -80,9 +80,12 @@ public class MetricsTag implements MetricsInfo {
   }
 
   @Override public String toString() {
-    return Objects.toStringHelper(this)
-        .add("info", info)
-        .add("value", value())
-        .toString();
+    StringBuilder sb = new StringBuilder(32);
+    sb.append(this.getClass().getSimpleName());
+    sb.append("{info=");
+    sb.append(info);
+    sb.append(", value=");
+    sb.append(value());
+    return sb.append('}').toString();
   }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/0aac5af6/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/AbstractMetricsRecord.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/AbstractMetricsRecord.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/AbstractMetricsRecord.java
index 3684c7e..cdcde14 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/AbstractMetricsRecord.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/AbstractMetricsRecord.java
@@ -43,12 +43,18 @@ abstract class AbstractMetricsRecord implements MetricsRecord {
   }
 
   @Override public String toString() {
-    return Objects.toStringHelper(this)
-        .add("timestamp", timestamp())
-        .add("name", name())
-        .add("description", description())
-        .add("tags", tags())
-        .add("metrics", Iterables.toString(metrics()))
-        .toString();
+    StringBuilder sb = new StringBuilder(32);
+    sb.append(this.getClass().getSimpleName());
+    sb.append("{timestamp=");
+    sb.append(timestamp());
+    sb.append(", name=");
+    sb.append(name());
+    sb.append(", description=");
+    sb.append(description());
+    sb.append(", tags=");
+    sb.append(tags());
+    sb.append(", metrics=");
+    sb.append(Iterables.toString(metrics()));
+    return sb.append('}').toString();
   }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/0aac5af6/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MsInfo.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MsInfo.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MsInfo.java
index 782f755..c66160f 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MsInfo.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MsInfo.java
@@ -18,8 +18,6 @@
 
 package org.apache.hadoop.metrics2.impl;
 
-import com.google.common.base.Objects;
-
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.metrics2.MetricsInfo;
 
@@ -48,8 +46,12 @@ public enum MsInfo implements MetricsInfo {
   }
 
   @Override public String toString() {
-    return Objects.toStringHelper(this)
-        .add("name", name()).add("description", desc)
-        .toString();
+    StringBuilder sb = new StringBuilder(32);
+    sb.append(this.getClass().getSimpleName());
+    sb.append("{name=");
+    sb.append(name());
+    sb.append(", description=");
+    sb.append(desc);
+    return sb.append('}').toString();
   }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/0aac5af6/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MetricsInfoImpl.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MetricsInfoImpl.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MetricsInfoImpl.java
index dfb6c35..79bba1f 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MetricsInfoImpl.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MetricsInfoImpl.java
@@ -55,8 +55,12 @@ class MetricsInfoImpl implements MetricsInfo {
   }
 
   @Override public String toString() {
-    return Objects.toStringHelper(this)
-        .add("name", name).add("description", description)
-        .toString();
+    StringBuilder sb = new StringBuilder(32);
+    sb.append(this.getClass().getSimpleName());
+    sb.append("{name=");
+    sb.append(name);
+    sb.append(", description=");
+    sb.append(description);
+    return sb.append('}').toString();
   }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/0aac5af6/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MetricsRegistry.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MetricsRegistry.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MetricsRegistry.java
index bdb607d..50880af 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MetricsRegistry.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MetricsRegistry.java
@@ -22,7 +22,6 @@ import java.util.Collection;
 import java.util.Map;
 
 import com.google.common.collect.Maps;
-import com.google.common.base.Objects;
 
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.classification.InterfaceStability;
@@ -450,9 +449,15 @@ public class MetricsRegistry {
   }
 
   @Override public String toString() {
-    return Objects.toStringHelper(this)
-        .add("info", metricsInfo).add("tags", tags()).add("metrics", metrics())
-        .toString();
+    StringBuilder sb = new StringBuilder(32);
+    sb.append(this.getClass().getSimpleName());
+    sb.append("{info=");
+    sb.append(metricsInfo);
+    sb.append(", tags=");
+    sb.append(tags());
+    sb.append(", metrics=");
+    sb.append(metrics());
+    return sb.append('}').toString();
   }
 
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/0aac5af6/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/source/JvmMetricsInfo.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/source/JvmMetricsInfo.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/source/JvmMetricsInfo.java
index 55bb417..e2b03f5 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/source/JvmMetricsInfo.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/source/JvmMetricsInfo.java
@@ -18,8 +18,6 @@
 
 package org.apache.hadoop.metrics2.source;
 
-import com.google.common.base.Objects;
-
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.metrics2.MetricsInfo;
 
@@ -60,8 +58,12 @@ public enum JvmMetricsInfo implements MetricsInfo {
   @Override public String description() { return desc; }
 
   @Override public String toString() {
-  return Objects.toStringHelper(this)
-      .add("name", name()).add("description", desc)
-      .toString();
+    StringBuilder sb = new StringBuilder(32);
+    sb.append(this.getClass().getSimpleName());
+    sb.append("{name=");
+    sb.append(name());
+    sb.append(", description=");
+    sb.append(desc);
+    return sb.append('}').toString();
   }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/0aac5af6/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/util/MetricsCache.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/util/MetricsCache.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/util/MetricsCache.java
index e659846..79edd64 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/util/MetricsCache.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/util/MetricsCache.java
@@ -29,7 +29,6 @@ import org.apache.hadoop.metrics2.AbstractMetric;
 import org.apache.hadoop.metrics2.MetricsRecord;
 import org.apache.hadoop.metrics2.MetricsTag;
 
-import com.google.common.base.Objects;
 import com.google.common.collect.Maps;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -127,9 +126,13 @@ public class MetricsCache {
     }
 
     @Override public String toString() {
-      return Objects.toStringHelper(this)
-          .add("tags", tags).add("metrics", metrics)
-          .toString();
+      StringBuilder sb = new StringBuilder(32);
+      sb.append(this.getClass().getSimpleName());
+      sb.append("{tags=");
+      sb.append(tags);
+      sb.append(", metrics=");
+      sb.append(metrics);
+      return sb.append('}').toString();
     }
   }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message