Package org.apache.helix.controller.rebalancer.context

Examples of org.apache.helix.controller.rebalancer.context.ReplicatedRebalancerContext


   * @param cluster
   * @return
   */
  private Map<State, Bounds> computeStateConstraints(StateModelDefinition stateModelDefinition,
      RebalancerConfig rebalancerConfig, Cluster cluster) {
    ReplicatedRebalancerContext context =
        (rebalancerConfig != null) ? rebalancerConfig
            .getRebalancerContext(ReplicatedRebalancerContext.class) : null;
    Map<State, Bounds> stateConstraints = new HashMap<State, Bounds>();

    List<State> statePriorityList = stateModelDefinition.getTypedStatesPriorityList();
    for (State state : statePriorityList) {
      String numInstancesPerState =
          cluster.getStateUpperBoundConstraint(Scope.cluster(cluster.getId()),
              stateModelDefinition.getStateModelDefId(), state);
      int max = -1;
      if ("N".equals(numInstancesPerState)) {
        max = cluster.getLiveParticipantMap().size();
      } else if ("R".equals(numInstancesPerState)) {
        // idealState is null when resource has been dropped,
        // R can't be evaluated and ignore state constraints
        if (context != null) {
          if (context.anyLiveParticipant()) {
            max = cluster.getLiveParticipantMap().size();
          } else {
            max = context.getReplicaCount();
          }
        }
      } else {
        try {
          max = Integer.parseInt(numInstancesPerState);
View Full Code Here

TOP

Related Classes of org.apache.helix.controller.rebalancer.context.ReplicatedRebalancerContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.