Example usage for org.apache.hadoop.hdfs.protocol DatanodeInfo isDecommissionInProgress

List of usage examples for org.apache.hadoop.hdfs.protocol DatanodeInfo isDecommissionInProgress

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs.protocol DatanodeInfo isDecommissionInProgress.

Prototype

public boolean isDecommissionInProgress() 

Source Link

Document

Returns true if the node is in the process of being decommissioned

Usage

From source file:mzb.Balancer.java

License:Apache License

private void initNodes(DatanodeInfo[] datanodes) {

    shuffleArray(datanodes);/*ww w.  ja  v a 2s .c om*/
    for (DatanodeInfo datanode : datanodes) {
        if (datanode.isDecommissioned() || datanode.isDecommissionInProgress()) {
            continue; // ignore decommissioning or decommissioned nodes
        }
        cluster.add(datanode);
        BalancerDatanode datanodeS = new Source(datanode);
        //this.datanodes.put(datanode.getHostName(), datanodeS);
        this.hostDatanodes.put(datanode.getHostName(), datanodeS);
        this.datanodes.put(datanode.getStorageID(), datanodeS);
        this.sources.add((Source) datanodeS);
        BalancerDatanode target = new BalancerDatanode(datanode);
        this.targets.add(target);
        this.targetsNodes.put(datanode.getHostName(), target);
    }
}

From source file:org.openflamingo.remote.thrift.thriftfs.ThriftUtils.java

License:Apache License

public static DatanodeInfo toThrift(org.apache.hadoop.hdfs.protocol.DatanodeInfo node,
        Map<DatanodeID, Integer> thriftPorts) {
    if (node == null) {
        return new DatanodeInfo();
    }/*from   w  w  w  . j  a v  a2s  .  c  o m*/

    DatanodeInfo ret = new DatanodeInfo();
    ret.name = node.getName();
    ret.storageID = node.storageID;
    ret.host = node.getHost();
    Integer p = thriftPorts.get(node);
    if (p == null) {
        LOG.warn("Unknown Thrift port for datanode " + node.name);
        ret.thriftPort = Constants.UNKNOWN_THRIFT_PORT;
    } else {
        ret.thriftPort = p.intValue();
    }

    ret.capacity = node.getCapacity();
    ret.dfsUsed = node.getDfsUsed();
    ret.remaining = node.getRemaining();
    ret.xceiverCount = node.getXceiverCount();
    ret.state = node.isDecommissioned() ? DatanodeState.DECOMMISSIONED
            : node.isDecommissionInProgress() ? DatanodeState.DECOMMISSION_INPROGRESS
                    : DatanodeState.NORMAL_STATE;
    ret.httpPort = node.getInfoPort();

    long timestamp = node.getLastUpdate();
    long currentTime = System.currentTimeMillis();
    ret.millisSinceUpdate = currentTime - timestamp;

    return ret;
}