ayushtkn commented on a change in pull request #3696:
URL: https://github.com/apache/hadoop/pull/3696#discussion_r762397861



##########
File path: 
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestBlockStoragePolicy.java
##########
@@ -1291,6 +1291,9 @@ public void testChooseTargetWithTopology() throws 
Exception {
         new HashSet<Node>(), 0, policy2, null);
     System.out.println(Arrays.asList(targets));
     Assert.assertEquals(3, targets.length);
+    if (namenode != null) {
+      namenode.stop();
+    }

Review comment:
       This should be in a finally block. eg:
   Namenode namenode = new Namenode(conf)
    try {
        Do Something
   } finally {
     if (namenode != null) {
         namenode.stop();
   }
   
   The reason being, in case the test fails after creation of namenode, in that 
case if it isn't in the finally block the stop command won't be executed.
   
   




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