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

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

Introduction

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

Prototype

public boolean isDecommissioned() 

Source Link

Document

Returns true if the node has been decommissioned.

Usage

From source file:mzb.Balancer.java

License:Apache License

private void initNodes(DatanodeInfo[] datanodes) {

    shuffleArray(datanodes);//from ww w  .  j ava2  s  . c o  m
    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 . jav a 2s.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;
}