public void rebalance() {
    int rebalanceDelay = 20;
    int activateDelay = 10;

    save();

    // deactivate();
    // timer.schedule(new ActivateTask(this), (rebalanceDelay + activateDelay) * 1000);

    // prevent nimbus from getting confused
    // if (localCluster != null) {
    // 	deactivate();
    // 	timer.schedule(new ActivateTask(this), (rebalanceDelay + activateDelay) * 1000);
    // }

    LOG.info("parallelism rebalance " + System.currentTimeMillis());
    for (String component : parallelism.keySet()) {
      LOG.info("parallelism " + component + " " + parallelism.get(component));
    }

    RebalanceOptions options = new RebalanceOptions();
    options.set_num_executors(parallelism);
    options.set_wait_secs(rebalanceDelay);
    try {
      System.out.println("REBALANCING: " + parallelism);
      if (localCluster != null) {
        localCluster.rebalance(topologyName, options);
      } else {
        NimbusClient client = NimbusClient.getConfiguredClient(stormConf);
        client.getClient().rebalance(topologyName, options);
      }
    } catch (Exception e) {
      System.out.println("rebalance() exception: " + e.toString());
    }
  }