Example usage for org.apache.hadoop.net NetworkTopology getInstance

List of usage examples for org.apache.hadoop.net NetworkTopology getInstance

Introduction

In this page you can find the example usage for org.apache.hadoop.net NetworkTopology getInstance.

Prototype

public static NetworkTopology getInstance(Configuration conf) 

Source Link

Document

Get an instance of NetworkTopology based on the value of the configuration parameter net.topology.impl.

Usage

From source file:mzb.Balancer.java

License:Apache License

/**
 * Construct a balancer.//from w  w w  .  ja v a 2s .c o m
 * Initialize balancer. It sets the value of the threshold, and 
 * builds the communication proxies to
 * namenode as a client and a secondary namenode and retry proxies
 * when connection fails.
 */
Balancer(NameNodeConnector theblockpool, Configuration conf) {
    //this.threshold = p.threshold;
    //this.policy = p.policy;
    this.nnc = theblockpool;
    cluster = NetworkTopology.getInstance(conf);

    this.moverExecutor = Executors.newFixedThreadPool(conf.getInt(DFSConfigKeys.DFS_BALANCER_MOVERTHREADS_KEY,
            DFSConfigKeys.DFS_BALANCER_MOVERTHREADS_DEFAULT));
    this.dispatcherExecutor = Executors
            .newFixedThreadPool(conf.getInt(DFSConfigKeys.DFS_BALANCER_DISPATCHERTHREADS_KEY,
                    DFSConfigKeys.DFS_BALANCER_DISPATCHERTHREADS_DEFAULT));
}

From source file:mzb.Balancer.java

License:Apache License

private void resetData(Configuration conf) {
    this.cluster = NetworkTopology.getInstance(conf);
    //    this.overUtilizedDatanodes.clear();
    //    this.aboveAvgUtilizedDatanodes.clear();
    //    this.belowAvgUtilizedDatanodes.clear();
    //    this.underUtilizedDatanodes.clear();
    this.datanodes.clear();
    this.hostDatanodes.clear();
    this.sources.clear();
    this.targets.clear();
    //this.policy.reset();
    cleanGlobalBlockList();//from ww  w. j a v  a2  s  . c  om
    this.movedBlocks.cleanup();
}