szetszwo commented on code in PR #677:
URL: https://github.com/apache/ratis/pull/677#discussion_r917300504


##########
ratis-server/src/main/java/org/apache/ratis/server/impl/ServerImplUtils.java:
##########
@@ -47,14 +50,12 @@ public static RaftServerProxy newRaftServer(
       RaftPeerId id, RaftGroup group, StateMachine.Registry 
stateMachineRegistry,
       RaftProperties properties, Parameters parameters) throws IOException {
     RaftServer.LOG.debug("newRaftServer: {}, {}", id, group);
-    final RaftServerProxy proxy = newRaftServer(id, stateMachineRegistry, 
properties, parameters);
-    proxy.initGroups(group);
-    return proxy;
-  }
 
-  private static RaftServerProxy newRaftServer(
-      RaftPeerId id, StateMachine.Registry stateMachineRegistry, 
RaftProperties properties, Parameters parameters)
-      throws IOException {
+    if (group != null && !group.getPeers().isEmpty()) {
+      final Set<RaftPeerId> ids = 
group.getPeers().stream().map(RaftPeer::getId).collect(Collectors.toSet());

Review Comment:
   Use RaftGroup.getPeer(id) instead of creating a set.



##########
ratis-server/src/main/java/org/apache/ratis/server/impl/ServerImplUtils.java:
##########
@@ -47,14 +50,12 @@ public static RaftServerProxy newRaftServer(
       RaftPeerId id, RaftGroup group, StateMachine.Registry 
stateMachineRegistry,
       RaftProperties properties, Parameters parameters) throws IOException {
     RaftServer.LOG.debug("newRaftServer: {}, {}", id, group);
-    final RaftServerProxy proxy = newRaftServer(id, stateMachineRegistry, 
properties, parameters);
-    proxy.initGroups(group);
-    return proxy;
-  }
 
-  private static RaftServerProxy newRaftServer(
-      RaftPeerId id, StateMachine.Registry stateMachineRegistry, 
RaftProperties properties, Parameters parameters)
-      throws IOException {

Review Comment:
   Please revert the unrelated changes.  The original code is more clear.



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