GlenGeng commented on a change in pull request #2227:
URL: https://github.com/apache/ozone/pull/2227#discussion_r629314116



##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMRatisServerImpl.java
##########
@@ -229,10 +229,19 @@ public void stop() throws IOException {
   public List<String> getRatisRoles() throws IOException {
     Collection<RaftPeer> peers = division.getGroup().getPeers();
     List<String> ratisRoles = new ArrayList<>();
+    InetAddress peerInetAddress = null;
     for (RaftPeer peer : peers) {
-      InetAddress peerInetAddress = InetAddress.getByName(
-              HddsUtils.getHostName(peer.getAddress()).get());
-      boolean isLocal = NetUtils.isLocalAddress(peerInetAddress);
+      try {

Review comment:
       NIT: narrow down the lifecycle of `peerInetAddress`
   ```
   for (RaftPeer peer : peers) {
     InetAddress peerInetAddress = null;
     try {
       //
     }
   ```




-- 
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to