Java Code Examples for org.apache.hadoop.hdfs.DFSUtil#parseRelativeTime()

The following examples show how to use org.apache.hadoop.hdfs.DFSUtil#parseRelativeTime() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CacheAdmin.java    From hadoop with Apache License 2.0 5 votes vote down vote up
private static CacheDirectiveInfo.Expiration parseExpirationString(String ttlString)
    throws IOException {
  CacheDirectiveInfo.Expiration ex = null;
  if (ttlString != null) {
    if (ttlString.equalsIgnoreCase("never")) {
      ex = CacheDirectiveInfo.Expiration.NEVER;
    } else {
      long ttl = DFSUtil.parseRelativeTime(ttlString);
      ex = CacheDirectiveInfo.Expiration.newRelative(ttl);
    }
  }
  return ex;
}
 
Example 2
Source File: AdminHelper.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * Parses a time-to-live value from a string
 * @return The ttl in milliseconds
 * @throws IOException if it could not be parsed
 */
static Long parseTtlString(String maxTtlString) throws IOException {
  Long maxTtl = null;
  if (maxTtlString != null) {
    if (maxTtlString.equalsIgnoreCase("never")) {
      maxTtl = CachePoolInfo.RELATIVE_EXPIRY_NEVER;
    } else {
      maxTtl = DFSUtil.parseRelativeTime(maxTtlString);
    }
  }
  return maxTtl;
}
 
Example 3
Source File: CacheAdmin.java    From big-c with Apache License 2.0 5 votes vote down vote up
private static CacheDirectiveInfo.Expiration parseExpirationString(String ttlString)
    throws IOException {
  CacheDirectiveInfo.Expiration ex = null;
  if (ttlString != null) {
    if (ttlString.equalsIgnoreCase("never")) {
      ex = CacheDirectiveInfo.Expiration.NEVER;
    } else {
      long ttl = DFSUtil.parseRelativeTime(ttlString);
      ex = CacheDirectiveInfo.Expiration.newRelative(ttl);
    }
  }
  return ex;
}
 
Example 4
Source File: AdminHelper.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * Parses a time-to-live value from a string
 * @return The ttl in milliseconds
 * @throws IOException if it could not be parsed
 */
static Long parseTtlString(String maxTtlString) throws IOException {
  Long maxTtl = null;
  if (maxTtlString != null) {
    if (maxTtlString.equalsIgnoreCase("never")) {
      maxTtl = CachePoolInfo.RELATIVE_EXPIRY_NEVER;
    } else {
      maxTtl = DFSUtil.parseRelativeTime(maxTtlString);
    }
  }
  return maxTtl;
}