code: private void init(InetSocketAddress namenodeAddress) throws IOException {
      this.namenodeAddress = namenodeAddress;
      this.myMetrics = new BalancerMetrics(conf, namenodeAddress);
      this.fetchBlocksSize = conf.getLong(BalancerConfigKeys.DFS_BALANCER_FETCH_SIZE_KEY,
          BalancerConfigKeys.DFS_BALANCER_FETCH_SIZE_DEFAULT);
      this.minBlockReplicas = conf.getInt(BalancerConfigKeys.DFS_BALANCER_MIN_REPLICAS_KEY,
          BalancerConfigKeys.DFS_BALANCER_MIN_REPLICAS_DEFAULT);
      this.maxFetchCount = conf.getInt(BalancerConfigKeys.DFS_BALANCER_FETCH_COUNT_KEY,
          BalancerConfigKeys.DFS_BALANCER_FETCH_COUNT_DEFAULT);
      initFS();
      initNameNodes();
      this.moverExecutor = Executors.newFixedThreadPool(moveThreads);
      int dispatchThreads = (int)Math.max(1, moveThreads/maxConcurrentMoves);
      this.dispatcherExecutor = Executors.newFixedThreadPool(dispatchThreads);
      /* Check if there is another balancer running.
       * Exit if there is another one running.
       */
      this.out = checkAndMarkRunningBalancer();
      if (out == null) {
        throw new IOException("Another balancer is running");
      }
      // get namespace id
      LocatedBlocksWithMetaInfo locations = client.openAndFetchMetaInfo(BALANCER_ID_PATH.toString(), 0L, 1L);
      this.namespaceId = locations.getNamespaceID();
    }
docs: /* 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.