Class CombinedHostsFileReader

java.lang.Object
org.apache.hadoop.hdfs.util.CombinedHostsFileReader

@LimitedPrivate("HDFS") @Unstable public final class CombinedHostsFileReader extends Object
Reader support for JSON-based datanode configuration, an alternative format to the exclude/include files configuration. The JSON file format defines the array of elements where each element in the array describes the properties of a datanode. The properties of a datanode is defined by DatanodeAdminProperties. For example, [ {"hostName": "host1"}, {"hostName": "host2", "port": 50, "upgradeDomain": "ud0"}, {"hostName": "host3", "port": 0, "adminState": "DECOMMISSIONED"} ]
  • Field Details

    • LOG

      public static final org.slf4j.Logger LOG
  • Method Details

    • readFile

      public static DatanodeAdminProperties[] readFile(String hostsFilePath) throws IOException
      Deserialize a set of DatanodeAdminProperties from a json file.
      Parameters:
      hostsFilePath - the input json file to read from
      Returns:
      the set of DatanodeAdminProperties
      Throws:
      IOException
    • readFileWithTimeout

      public static DatanodeAdminProperties[] readFileWithTimeout(String hostsFile, int readTimeout) throws IOException
      Wrapper to call readFile with timeout via Future Tasks. If timeout is reached, it will throw IOException
      Parameters:
      hostsFile - the input json file to read from
      readTimeout - timeout for FutureTask execution in milliseconds
      Returns:
      the set of DatanodeAdminProperties
      Throws:
      IOException