jianghuazhu commented on code in PR #7145:
URL: https://github.com/apache/ozone/pull/7145#discussion_r1767990949


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/HddsDispatcher.java:
##########
@@ -647,12 +647,10 @@ public Handler getHandler(ContainerProtos.ContainerType 
containerType) {
 
   @Override
   public void setClusterId(String clusterId) {
-    Preconditions.checkNotNull(clusterId, "clusterId Cannot be null");
-    if (this.clusterId == null) {
-      this.clusterId = clusterId;
-      for (Map.Entry<ContainerType, Handler> handlerMap : handlers.entrySet()) 
{
-        handlerMap.getValue().setClusterID(clusterId);
-      }
+    Preconditions.checkNotNull(clusterId, "clusterId cannot be null");

Review Comment:
   Thanks @ChenSammi .
   I modified some code here. There are some main reasons:
   1. The errorMessage contained in Preconditions.checkNotNull() has a typo.
   `Cannot` should be changed to `cannot`.
   2. The old code added an if check, which means that clusterId can only be 
assigned once, which is too strict.
   ```
   if (this.clusterId == null) {
     this.clusterId = clusterId;
     ...... 
   }   
   ```
   These are related to clusterId, so I updated them together.
   This is my idea.
   What do you think?
   



-- 
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.

To unsubscribe, e-mail: [email protected]

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