steveloughran commented on a change in pull request #1803: HADOOP-16621. 
[pb-upgrade] Remove Protobuf classes from signatures of Public APIs.
URL: https://github.com/apache/hadoop/pull/1803#discussion_r365747260
 
 

 ##########
 File path: 
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/ProtobufHelper.java
 ##########
 @@ -46,4 +52,67 @@ public static IOException 
getRemoteException(ServiceException se) {
     }
     return e instanceof IOException ? (IOException) e : new IOException(se);
   }
+
+
+  /**
+   * Map used to cache fixed strings to ByteStrings. Since there is no
+   * automatic expiration policy, only use this for strings from a fixed, small
+   * set.
+   * <p/>
+   * This map should not be accessed directly. Used the getFixedByteString
+   * methods instead.
+   */
+  private static ConcurrentHashMap<Object, ByteString> fixedByteStringCache =
+      new ConcurrentHashMap<>();
+
+  /**
+   * Get the ByteString for frequently used fixed and small set strings.
+   * @param key string
+   * @return
+   */
+  public static ByteString getFixedByteString(Text key) {
 
 Review comment:
   Is there any risk this will grow to a size it becomes a problem? If not, 
using a guava cache is overkill, if there is a risk then yes, we would need to

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to