Java Code Examples for org.apache.hadoop.hdfs.server.namenode.NameNode#isInSafeMode()

The following examples show how to use org.apache.hadoop.hdfs.server.namenode.NameNode#isInSafeMode() . 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: MiniDFSCluster.java    From RDFS with Apache License 2.0 6 votes vote down vote up
/**
 * Returns true if the NameNode is running and is out of Safe Mode
 * or if waiting for safe mode is disabled.
 */
public boolean isNameNodeUp(int nnIndex) {
  NameNode nn = nameNodes[nnIndex].nameNode;
  if (nn == null) {
    return false;
  }
  try {
    long[] sizes = nn.getStats();
    boolean isUp = false;
    synchronized (this) {
      isUp = ((!nn.isInSafeMode() || !waitSafeMode) && sizes[0] != 0);
    }
    return isUp;
  } catch (IOException ie) {
    return false;
  }
}
 
Example 2
Source File: MiniDFSCluster.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * Returns true if the NameNode is running and is out of Safe Mode
 * or if waiting for safe mode is disabled.
 */
public boolean isNameNodeUp(int nnIndex) {
  NameNode nameNode = nameNodes[nnIndex].nameNode;
  if (nameNode == null) {
    return false;
  }
  long[] sizes;
  sizes = NameNodeAdapter.getStats(nameNode.getNamesystem());
  boolean isUp = false;
  synchronized (this) {
    isUp = ((!nameNode.isInSafeMode() || !waitSafeMode) &&
        sizes[ClientProtocol.GET_STATS_CAPACITY_IDX] != 0);
  }
  return isUp;
}
 
Example 3
Source File: MiniDFSCluster.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * Returns true if the NameNode is running and is out of Safe Mode
 * or if waiting for safe mode is disabled.
 */
public boolean isNameNodeUp(int nnIndex) {
  NameNode nameNode = nameNodes[nnIndex].nameNode;
  if (nameNode == null) {
    return false;
  }
  long[] sizes;
  sizes = NameNodeAdapter.getStats(nameNode.getNamesystem());
  boolean isUp = false;
  synchronized (this) {
    isUp = ((!nameNode.isInSafeMode() || !waitSafeMode) &&
        sizes[ClientProtocol.GET_STATS_CAPACITY_IDX] != 0);
  }
  return isUp;
}