Example usage for org.apache.hadoop.hdfs.server.namenode NameNodeAdapter getStats

List of usage examples for org.apache.hadoop.hdfs.server.namenode NameNodeAdapter getStats

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs.server.namenode NameNodeAdapter getStats.

Prototype

public static long[] getStats(final FSNamesystem fsn) 

Source Link

Document

Return the FSNamesystem stats

Usage

From source file:com.mellanox.r4h.MiniDFSCluster.java

License:Apache License

/**
 * Returns true if the NameNode is running and is out of Safe Mode
 * or if waiting for safe mode is disabled.
 *//*from   ww  w .j ava2  s  .  com*/
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;
}