liuml07 commented on a change in pull request #2327:
URL: https://github.com/apache/hadoop/pull/2327#discussion_r496186593



##########
File path: 
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/CallerContext.java
##########
@@ -123,6 +140,37 @@ public Builder setSignature(byte[] signature) {
       return this;
     }
 
+    /**
+     * Append new item to the context.
+     * @param item
+     * @return builder
+     */
+    public Builder append(String item) {
+      if (isValid(item)) {
+        if (sb.length() > 0) {
+          sb.append(separator);
+        }
+        sb.append(item);
+      }
+      return this;
+    }
+
+    /**
+     * Append new item which contains key and value to the context.
+     * @param key
+     * @param value
+     * @return builder
+     */
+    public Builder append(String key, String value) {
+      if (isValid(key) && isValid(value)) {
+        if (sb.length() > 0) {
+          sb.append(separator);
+        }
+        sb.append(key + ":" + value);

Review comment:
       Yes making `:`a constant and replacing `+` with `append()` both make 
perfect sense.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to