Author: cmccabe
Date: Mon Jun  3 17:14:27 2013
New Revision: 1489065

URL: http://svn.apache.org/r1489065
Log:
HDFS-3934. duplicative dfs_hosts entries handled wrong. (cmccabe)


Modified:
    
hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/HostsFileReader.java

Modified: 
hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/HostsFileReader.java
URL: 
http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/HostsFileReader.java?rev=1489065&r1=1489064&r2=1489065&view=diff
==============================================================================
--- 
hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/HostsFileReader.java
 (original)
+++ 
hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/HostsFileReader.java
 Mon Jun  3 17:14:27 2013
@@ -48,7 +48,8 @@ public class HostsFileReader {
     refresh();
   }
 
-  private void readFileToSet(String filename, Set<String> set) throws 
IOException {
+  public static void readFileToSet(String type,
+      String filename, Set<String> set) throws IOException {
     File file = new File(filename);
     FileInputStream fis = new FileInputStream(file);
     BufferedReader reader = null;
@@ -64,8 +65,9 @@ public class HostsFileReader {
               break;
             }
             if (!nodes[i].isEmpty()) {
-              LOG.info("Adding " + nodes[i] + " to the list of hosts from " + 
filename);
-              set.add(nodes[i]);  // might need to add canonical name
+              LOG.info("Adding " + nodes[i] + " to the list of " + type +
+                  " hosts from " + filename);
+              set.add(nodes[i]);
             }
           }
         }
@@ -82,13 +84,13 @@ public class HostsFileReader {
     LOG.info("Refreshing hosts (include/exclude) list");
     if (!includesFile.isEmpty()) {
       Set<String> newIncludes = new HashSet<String>();
-      readFileToSet(includesFile, newIncludes);
+      readFileToSet("included", includesFile, newIncludes);
       // switch the new hosts that are to be included
       includes = newIncludes;
     }
     if (!excludesFile.isEmpty()) {
       Set<String> newExcludes = new HashSet<String>();
-      readFileToSet(excludesFile, newExcludes);
+      readFileToSet("excluded", excludesFile, newExcludes);
       // switch the excluded hosts
       excludes = newExcludes;
     }


Reply via email to