Class Util
java.lang.Object
org.apache.hadoop.hdfs.server.common.Util
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.hadoop.io.MD5HashdoGetUrl(URL url, List<File> localPaths, Storage dstStorage, boolean getChecksum, int timeout, DataTransferThrottler throttler) Downloads the files at the specified url location into destination storage.static URIConverts the passed File to a URI.static List<InetSocketAddress>getAddressesList(URI uri, org.apache.hadoop.conf.Configuration conf) static floatgetBlockPoolUsedPercentStdDev(org.apache.hadoop.hdfs.server.protocol.StorageReport[] storageReports) Return the standard deviation of storage block pool usage.static List<InetSocketAddress>getLoggerAddresses(URI uri, Set<InetSocketAddress> addrsToExclude, org.apache.hadoop.conf.Configuration conf) static booleanisDiskStatsEnabled(int fileIOSamplingPercentage) static org.apache.hadoop.io.MD5HashreceiveFile(String url, List<File> localPaths, Storage dstStorage, boolean getChecksum, long advertisedSize, org.apache.hadoop.io.MD5Hash advertisedDigest, String fsImageName, InputStream stream, DataTransferThrottler throttler) Receives file at the url location from the input stream and puts them in the specified destination storage location.static voidsetTimeout(HttpURLConnection connection, int timeout) Sets a timeout value in millisecods for the Http connection.stringCollectionAsURIs(Collection<String> names) Converts a collection of strings into a collection of URIs.
-
Field Details
-
FILE_LENGTH
- See Also:
-
CONTENT_LENGTH
- See Also:
-
MD5_HEADER
- See Also:
-
CONTENT_TYPE
- See Also:
-
CONTENT_TRANSFER_ENCODING
- See Also:
-
IO_FILE_BUFFER_SIZE
public static final int IO_FILE_BUFFER_SIZE -
connectionFactory
public static final org.apache.hadoop.hdfs.web.URLConnectionFactory connectionFactory
-
-
Constructor Details
-
Util
public Util()
-
-
Method Details
-
fileAsURI
Converts the passed File to a URI. This method trims the trailing slash if one is appended because the underlying file is in fact a directory that exists.- Parameters:
f- the file to convert- Returns:
- the resulting URI
- Throws:
IOException
-
stringCollectionAsURIs
Converts a collection of strings into a collection of URIs.- Parameters:
names- collection of strings to convert to URIs- Returns:
- collection of URIs
-
doGetUrl
public static org.apache.hadoop.io.MD5Hash doGetUrl(URL url, List<File> localPaths, Storage dstStorage, boolean getChecksum, int timeout, DataTransferThrottler throttler) throws IOException Downloads the files at the specified url location into destination storage.- Throws:
IOException
-
receiveFile
public static org.apache.hadoop.io.MD5Hash receiveFile(String url, List<File> localPaths, Storage dstStorage, boolean getChecksum, long advertisedSize, org.apache.hadoop.io.MD5Hash advertisedDigest, String fsImageName, InputStream stream, DataTransferThrottler throttler) throws IOException Receives file at the url location from the input stream and puts them in the specified destination storage location.- Throws:
IOException
-
setTimeout
Sets a timeout value in millisecods for the Http connection.- Parameters:
connection- the Http connection for which timeout needs to be settimeout- value to be set as timeout in milliseconds
-
getAddressesList
public static List<InetSocketAddress> getAddressesList(URI uri, org.apache.hadoop.conf.Configuration conf) throws IOException - Throws:
IOException
-
getLoggerAddresses
public static List<InetSocketAddress> getLoggerAddresses(URI uri, Set<InetSocketAddress> addrsToExclude, org.apache.hadoop.conf.Configuration conf) throws IOException - Throws:
IOException
-
isDiskStatsEnabled
public static boolean isDiskStatsEnabled(int fileIOSamplingPercentage) -
getBlockPoolUsedPercentStdDev
public static float getBlockPoolUsedPercentStdDev(org.apache.hadoop.hdfs.server.protocol.StorageReport[] storageReports) Return the standard deviation of storage block pool usage.
-