Package org.apache.hadoop.hdfs.util
Class CombinedHostsFileReader
java.lang.Object
org.apache.hadoop.hdfs.util.CombinedHostsFileReader
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 Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic DatanodeAdminProperties[]Deserialize a set of DatanodeAdminProperties from a json file.static DatanodeAdminProperties[]readFileWithTimeout(String hostsFile, int readTimeout) Wrapper to call readFile with timeout via Future Tasks.
-
Field Details
-
LOG
public static final org.slf4j.Logger LOG
-
-
Method Details
-
readFile
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 fromreadTimeout- timeout for FutureTask execution in milliseconds- Returns:
- the set of DatanodeAdminProperties
- Throws:
IOException
-