dineshchitlangia commented on a change in pull request #71: HDDS-2344. Add immutable entries in to the DoubleBuffer for Volume requests. URL: https://github.com/apache/hadoop-ozone/pull/71#discussion_r338056264
########## File path: hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmOzoneAclMap.java ########## @@ -298,4 +303,27 @@ public static OmOzoneAclMap ozoneAclGetFromProtobuf( public List<OzoneAclInfo> getDefaultAclList() { return defaultAclList; } + + @Override + public Object clone() { + ArrayList<Map<String, BitSet>> accessMap = new ArrayList<>(); + + // Initialize. + for (OzoneAclType aclType : OzoneAclType.values()) { + accessMap.add(aclType.ordinal(), new HashMap<>()); + } + + // Add from original accessAclMap to accessMap. + for (OzoneAclType aclType : OzoneAclType.values()) { + final int ordinal = aclType.ordinal(); + accessAclMap.get(ordinal).forEach((k, v) -> + accessMap.get(ordinal).put(k, (BitSet) v.clone())); + } + + // We can do shallow copy here, as OzoneAclInfo is immutable structure. + ArrayList<OzoneAclInfo> defaultList = new ArrayList<>(); + defaultList.addAll(defaultAclList); + + return new OmOzoneAclMap(defaultList, accessMap); + } Review comment: Given the use case and avoid shallow copy, it is better to make it final. ---------------------------------------------------------------- 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: hdfs-dev-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-dev-h...@hadoop.apache.org