wyyl1 commented on code in PR #7789:
URL: https://github.com/apache/rocketmq/pull/7789#discussion_r1500508577


##########
client/src/main/java/org/apache/rocketmq/client/consumer/rebalance/AllocateMachineRoomNearby.java:
##########
@@ -40,28 +41,35 @@ public class AllocateMachineRoomNearby extends 
AbstractAllocateMessageQueueStrat
 
     public AllocateMachineRoomNearby(AllocateMessageQueueStrategy 
allocateMessageQueueStrategy,
         MachineRoomResolver machineRoomResolver) throws NullPointerException {
+        checkParams(allocateMessageQueueStrategy, machineRoomResolver);
+
+        this.allocateMessageQueueStrategy = allocateMessageQueueStrategy;
+        this.machineRoomResolver = machineRoomResolver;
+    }
+
+    private static void checkParams(AllocateMessageQueueStrategy 
allocateMessageQueueStrategy,

Review Comment:
   Reasons for extracting the checkParams method:
   
   1. Improved code readability: Code is documentation.
   2. Improved code testability: It allows for unit testing of the checkParams 
method without concerning its callers.



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

Reply via email to