當前位置: 首頁>>代碼示例>>Java>>正文


Java Shell.LINUX屬性代碼示例

本文整理匯總了Java中org.apache.hadoop.util.Shell.LINUX屬性的典型用法代碼示例。如果您正苦於以下問題:Java Shell.LINUX屬性的具體用法?Java Shell.LINUX怎麽用?Java Shell.LINUX使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.apache.hadoop.util.Shell的用法示例。


在下文中一共展示了Shell.LINUX屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getExecString

@Override
protected String[] getExecString() {
  String derefFlag = "-";
  if (dereference) {
    derefFlag = "-L";
  }
  if (Shell.LINUX) {
    return new String[] {
        "stat", derefFlag + "c", "%s,%F,%Y,%X,%a,%U,%G,%N", path.toString() };
  } else if (Shell.FREEBSD || Shell.MAC) {
    return new String[] {
        "stat", derefFlag + "f", "%z,%HT,%m,%a,%Op,%Su,%Sg,`link' -> `%Y'",
        path.toString() };
  } else {
    throw new UnsupportedOperationException(
        "stat is not supported on this platform");
  }
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:18,代碼來源:Stat.java

示例2: getResourceCalculatorPlugin

/**
 * Create the ResourceCalculatorPlugin from the class name and configure it. If
 * class name is null, this method will try and return a memory calculator
 * plugin available for this system.
 *
 * @param clazz ResourceCalculator plugin class-name
 * @param conf configure the plugin with this.
 * @return ResourceCalculatorPlugin or null if ResourceCalculatorPlugin is not
 * 		 available for current system
 */
public static ResourceCalculatorPlugin getResourceCalculatorPlugin(
    Class<? extends ResourceCalculatorPlugin> clazz, Configuration conf) {

  if (clazz != null) {
    return ReflectionUtils.newInstance(clazz, conf);
  }

  // No class given, try a os specific class
  try {
    if (Shell.LINUX) {
      return new LinuxResourceCalculatorPlugin();
    }
    if (Shell.WINDOWS) {
      return new WindowsResourceCalculatorPlugin();
    }
  } catch (SecurityException se) {
    // Failed to get Operating System name.
    return null;
  }

  // Not supported on this system.
  return null;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:33,代碼來源:ResourceCalculatorPlugin.java

示例3: isAvailable

/**
 * Whether Stat is supported on the current platform
 * @return
 */
public static boolean isAvailable() {
  if (Shell.LINUX || Shell.FREEBSD || Shell.MAC) {
    return true;
  }
  return false;
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:10,代碼來源:Stat.java

示例4: isAvailable

/**
 * Checks if the ProcfsBasedProcessTree is available on this system.
 *
 * @return true if ProcfsBasedProcessTree is available. False otherwise.
 */
public static boolean isAvailable() {
  try {
    if (!Shell.LINUX) {
      LOG.info("ProcfsBasedProcessTree currently is supported only on "
          + "Linux.");
      return false;
    }
  } catch (SecurityException se) {
    LOG.warn("Failed to get Operating System name. " + se);
    return false;
  }
  return true;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:18,代碼來源:ProcfsBasedProcessTree.java

示例5: getThisLocalResourceTag

public static String getThisLocalResourceTag(){
   /*
      2.6.32-431.29.2.el6.x86_64
      3.10.0-514.6.1.el7.x86_64
   */
  String osVersion = System.getProperty("os.version");
  if(osVersion == null){
    return null;
  }

  if(Shell.LINUX){

    if(osVersion.contains("el6")) {
      return LR_TAG_CENTOS6;
    }

    if(osVersion.contains("el7")) {
      return LR_TAG_CENTOS7;
    }
  }
  if(Shell.MAC){
    if(osVersion.startsWith("10.")) {
      return LR_TAG_MACOS10;
    }
  }

  return null;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:28,代碼來源:OwnLocalResources.java


注:本文中的org.apache.hadoop.util.Shell.LINUX屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。