Skip to content

Commit 3d8c435

Browse files
committed
merge YARN-1045. Improve toString implementation for PBImpls. Contributed by Jian He.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2.1.0-beta@1514431 13f79535-47bb-0310-9956-ffa450edef68
1 parent 3c4aef7 commit 3d8c435

File tree

69 files changed

+204
-74
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+204
-74
lines changed

hadoop-yarn-project/CHANGES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Release 2.1.1-beta - UNRELEASED
88

99
IMPROVEMENTS
1010

11+
YARN-589. Expose a REST API for monitoring the fair scheduler (Sandy Ryza).
12+
1113
OPTIMIZATIONS
1214

1315
BUG FIXES
@@ -464,6 +466,8 @@ Release 2.1.0-beta - 2013-08-06
464466
YARN-1046. Disable mem monitoring by default in MiniYARNCluster. (Karthik
465467
Kambatla via Sandy Ryza)
466468

469+
YARN-1045. Improve toString implementation for PBImpls. (Jian He via sseth)
470+
467471
OPTIMIZATIONS
468472

469473
YARN-512. Log aggregation root directory check is more expensive than it

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/AllocateRequestPBImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
import org.apache.hadoop.yarn.proto.YarnServiceProtos.AllocateRequestProto;
3939
import org.apache.hadoop.yarn.proto.YarnServiceProtos.AllocateRequestProtoOrBuilder;
4040

41+
import com.google.protobuf.TextFormat;
42+
4143
@Private
4244
@Unstable
4345
public class AllocateRequestPBImpl extends AllocateRequest {
@@ -83,7 +85,7 @@ public boolean equals(Object other) {
8385

8486
@Override
8587
public String toString() {
86-
return getProto().toString().replaceAll("\\n", ", ").replaceAll("\\s+", " ");
88+
return TextFormat.shortDebugString(getProto());
8789
}
8890

8991
private void mergeLocalToBuilder() {

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/AllocateResponsePBImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
import org.apache.hadoop.yarn.proto.YarnServiceProtos.AllocateResponseProtoOrBuilder;
5050
import org.apache.hadoop.yarn.proto.YarnServiceProtos.NMTokenProto;
5151

52+
import com.google.protobuf.TextFormat;
53+
5254
@Private
5355
@Unstable
5456
public class AllocateResponsePBImpl extends AllocateResponse {
@@ -99,7 +101,7 @@ public boolean equals(Object other) {
99101

100102
@Override
101103
public String toString() {
102-
return getProto().toString().replaceAll("\\n", ", ").replaceAll("\\s+", " ");
104+
return TextFormat.shortDebugString(getProto());
103105
}
104106

105107
private synchronized void mergeLocalToBuilder() {

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/CancelDelegationTokenRequestPBImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
import org.apache.hadoop.yarn.api.records.Token;
2727
import org.apache.hadoop.yarn.api.records.impl.pb.TokenPBImpl;
2828

29+
import com.google.protobuf.TextFormat;
30+
2931
@Private
3032
@Unstable
3133
public class CancelDelegationTokenRequestPBImpl extends
@@ -90,7 +92,7 @@ public boolean equals(Object other) {
9092

9193
@Override
9294
public String toString() {
93-
return getProto().toString().replaceAll("\\n", ", ").replaceAll("\\s+", " ");
95+
return TextFormat.shortDebugString(getProto());
9496
}
9597

9698
private void mergeLocalToBuilder() {

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/CancelDelegationTokenResponsePBImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import org.apache.hadoop.security.proto.SecurityProtos.CancelDelegationTokenResponseProto;
2323
import org.apache.hadoop.yarn.api.protocolrecords.CancelDelegationTokenResponse;
2424

25+
import com.google.protobuf.TextFormat;
26+
2527
@Private
2628
@Unstable
2729
public class CancelDelegationTokenResponsePBImpl extends CancelDelegationTokenResponse {
@@ -58,6 +60,6 @@ public boolean equals(Object other) {
5860

5961
@Override
6062
public String toString() {
61-
return getProto().toString().replaceAll("\\n", ", ").replaceAll("\\s+", " ");
63+
return TextFormat.shortDebugString(getProto());
6264
}
6365
}

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/FinishApplicationMasterRequestPBImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
import org.apache.hadoop.yarn.proto.YarnServiceProtos.FinishApplicationMasterRequestProto;
2929
import org.apache.hadoop.yarn.proto.YarnServiceProtos.FinishApplicationMasterRequestProtoOrBuilder;
3030

31+
import com.google.protobuf.TextFormat;
32+
3133
@Private
3234
@Unstable
3335
public class FinishApplicationMasterRequestPBImpl extends FinishApplicationMasterRequest {
@@ -68,7 +70,7 @@ public boolean equals(Object other) {
6870

6971
@Override
7072
public String toString() {
71-
return getProto().toString().replaceAll("\\n", ", ").replaceAll("\\s+", " ");
73+
return TextFormat.shortDebugString(getProto());
7274
}
7375

7476
private void mergeLocalToBuilder() {

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/FinishApplicationMasterResponsePBImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse;
2525
import org.apache.hadoop.yarn.proto.YarnServiceProtos.FinishApplicationMasterResponseProto;
2626

27+
import com.google.protobuf.TextFormat;
28+
2729
@Private
2830
@Unstable
2931
public class FinishApplicationMasterResponsePBImpl extends FinishApplicationMasterResponse {
@@ -63,6 +65,6 @@ public boolean equals(Object other) {
6365

6466
@Override
6567
public String toString() {
66-
return getProto().toString().replaceAll("\\n", ", ").replaceAll("\\s+", " ");
68+
return TextFormat.shortDebugString(getProto());
6769
}
6870
}

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetApplicationReportRequestPBImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationReportRequestProto;
2929
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationReportRequestProtoOrBuilder;
3030

31+
import com.google.protobuf.TextFormat;
32+
3133
@Private
3234
@Unstable
3335
public class GetApplicationReportRequestPBImpl extends GetApplicationReportRequest {
@@ -71,7 +73,7 @@ public boolean equals(Object other) {
7173

7274
@Override
7375
public String toString() {
74-
return getProto().toString().replaceAll("\\n", ", ").replaceAll("\\s+", " ");
76+
return TextFormat.shortDebugString(getProto());
7577
}
7678

7779
private void mergeLocalToBuilder() {

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetApplicationReportResponsePBImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationReportResponseProto;
2929
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationReportResponseProtoOrBuilder;
3030

31+
import com.google.protobuf.TextFormat;
32+
3133
@Private
3234
@Unstable
3335
public class GetApplicationReportResponsePBImpl extends GetApplicationReportResponse {
@@ -71,7 +73,7 @@ public boolean equals(Object other) {
7173

7274
@Override
7375
public String toString() {
74-
return getProto().toString().replaceAll("\\n", ", ").replaceAll("\\s+", " ");
76+
return TextFormat.shortDebugString(getProto());
7577
}
7678

7779
private void mergeLocalToBuilder() {

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetApplicationsRequestPBImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationsRequestProto;
2929
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationsRequestProtoOrBuilder;
3030

31+
import com.google.protobuf.TextFormat;
32+
3133
@Private
3234
@Unstable
3335
public class GetApplicationsRequestPBImpl extends GetApplicationsRequest {
@@ -123,6 +125,6 @@ public boolean equals(Object other) {
123125

124126
@Override
125127
public String toString() {
126-
return getProto().toString().replaceAll("\\n", ", ").replaceAll("\\s+", " ");
128+
return TextFormat.shortDebugString(getProto());
127129
}
128130
}

0 commit comments

Comments
 (0)