java.lang.Object
org.apache.hadoop.hdfs.server.common.Util

@Private public final class Util extends Object
  • Field Details

  • Constructor Details

    • Util

      public Util()
  • Method Details

    • fileAsURI

      public static URI fileAsURI(File f) throws IOException
      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

      public static List<URI> stringCollectionAsURIs(Collection<String> names)
      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

      public static void setTimeout(HttpURLConnection connection, int timeout)
      Sets a timeout value in millisecods for the Http connection.
      Parameters:
      connection - the Http connection for which timeout needs to be set
      timeout - 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.