当前位置: 首页>>代码示例>>Java>>正文


Java FSConstants.SafeModeAction方法代码示例

本文整理汇总了Java中org.apache.hadoop.hdfs.protocol.FSConstants.SafeModeAction方法的典型用法代码示例。如果您正苦于以下问题:Java FSConstants.SafeModeAction方法的具体用法?Java FSConstants.SafeModeAction怎么用?Java FSConstants.SafeModeAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hdfs.protocol.FSConstants的用法示例。


在下文中一共展示了FSConstants.SafeModeAction方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setSafeMode

import org.apache.hadoop.hdfs.protocol.FSConstants; //导入方法依赖的package包/类
/**
 * Safe mode maintenance command.
 * Usage: java DFSAdmin -safemode [enter | leave | get | wait | initqueues]
 * @param argv List of of command line parameters.
 * @param idx The index of the command that is being processed.
 * @exception IOException if the filesystem does not exist.
 */
public void setSafeMode(String[] argv, int idx) throws IOException {
  DistributedFileSystem dfs = getDFS();
  if (dfs == null) {
    System.err.println("FileSystem is " + getFS().getUri());
    return;
  }
  if (idx != argv.length - 1) {
    printUsage("-safemode");
    return;
  }
  FSConstants.SafeModeAction action;
  Boolean waitExitSafe = false;

  if ("leave".equalsIgnoreCase(argv[idx])) {
    action = FSConstants.SafeModeAction.SAFEMODE_LEAVE;
  } else if ("enter".equalsIgnoreCase(argv[idx])) {
    action = FSConstants.SafeModeAction.SAFEMODE_ENTER;
  } else if ("get".equalsIgnoreCase(argv[idx])) {
    action = FSConstants.SafeModeAction.SAFEMODE_GET;
  } else if ("initqueues".equalsIgnoreCase(argv[idx])) {
    action = FSConstants.SafeModeAction.SAFEMODE_INITQUEUES;
  } else if ("wait".equalsIgnoreCase(argv[idx])) {
    action = FSConstants.SafeModeAction.SAFEMODE_GET;
    waitExitSafe = true;
  } else {
    printUsage("-safemode");
    return;
  }
  boolean inSafeMode = dfs.setSafeMode(action);

  //
  // If we are waiting for safemode to exit, then poll and
  // sleep till we are out of safemode.
  //
  if (waitExitSafe) {
    while (inSafeMode) {
      try {
        Thread.sleep(5000);
      } catch (java.lang.InterruptedException e) {
        throw new IOException("Wait Interrupted");
      }
      inSafeMode = dfs.setSafeMode(action);
    }
  }

  System.out.println("Safe mode is " + (inSafeMode ? "ON" : "OFF"));
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:55,代码来源:DFSAdmin.java

示例2: setSafeMode

import org.apache.hadoop.hdfs.protocol.FSConstants; //导入方法依赖的package包/类
/**
 * Enter, leave or get safe mode.
 *  
 * @see org.apache.hadoop.hdfs.protocol.ClientProtocol#setSafeMode(
 *    FSConstants.SafeModeAction)
 */
public boolean setSafeMode(FSConstants.SafeModeAction action) 
throws IOException {
  return dfs.setSafeMode(action);
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:11,代码来源:DistributedFileSystem.java

示例3: setSafeMode

import org.apache.hadoop.hdfs.protocol.FSConstants; //导入方法依赖的package包/类
/**
 * Enter, leave or get safe mode.
 *  
 * @see org.apache.hadoop.hdfs.protocol.ClientProtocol#setSafeMode(FSConstants.SafeModeAction)
 */
public boolean setSafeMode(FSConstants.SafeModeAction action) 
  throws IOException {
  return getDFS().setSafeMode(action);
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:10,代码来源:ChecksumDistributedFileSystem.java


注:本文中的org.apache.hadoop.hdfs.protocol.FSConstants.SafeModeAction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。