Package org.apache.helix.controller.rebalancer

Examples of org.apache.helix.controller.rebalancer.SemiAutoRebalancer


        logger
            .info("resource " + resourceName + " use idealStateRebalancer " + rebalancerClassName);
        try {
          rebalancer =
              (Rebalancer) (HelixUtil.loadClass(getClass(), rebalancerClassName).newInstance());
          mappingCalculator = new SemiAutoRebalancer();
        } catch (Exception e) {
          logger.warn("Exception while invoking custom rebalancer class:" + rebalancerClassName, e);
        }
      }
      if (rebalancer == null) {
        if (idealState.getRebalanceMode() == RebalanceMode.FULL_AUTO) {
          rebalancer = new AutoRebalancer();
          mappingCalculator = new AutoRebalancer();
        } else if (idealState.getRebalanceMode() == RebalanceMode.SEMI_AUTO) {
          rebalancer = new SemiAutoRebalancer();
          mappingCalculator = new SemiAutoRebalancer();
        } else {
          rebalancer = new CustomRebalancer();
          mappingCalculator = new CustomRebalancer();
        }
        idealState =
View Full Code Here


        AutoRebalancer autoRebalancer = new AutoRebalancer();
        rebalancer = autoRebalancer;
        mappingCalculator = autoRebalancer;
        break;
      case SEMI_AUTO:
        SemiAutoRebalancer semiAutoRebalancer = new SemiAutoRebalancer();
        rebalancer = semiAutoRebalancer;
        mappingCalculator = semiAutoRebalancer;
        break;
      case CUSTOMIZED:
        CustomRebalancer customRebalancer = new CustomRebalancer();
        rebalancer = customRebalancer;
        mappingCalculator = customRebalancer;
        break;
      case USER_DEFINED:
      case TASK:
        String rebalancerClassName = idealState.getRebalancerClassName();
        logger
            .info("resource " + resourceName + " use idealStateRebalancer " + rebalancerClassName);
        try {
          rebalancer =
              Rebalancer.class.cast(HelixUtil.loadClass(getClass(), rebalancerClassName)
                  .newInstance());
        } catch (Exception e) {
          logger.warn("Exception while invoking custom rebalancer class:" + rebalancerClassName, e);
        }
        if (rebalancer != null) {
          try {
            mappingCalculator = MappingCalculator.class.cast(rebalancer);
          } catch (ClassCastException e) {
            logger.info("Rebalancer does not have a mapping calculator, defaulting to SEMI_AUTO");
          }
        }
        if (mappingCalculator == null) {
          mappingCalculator = new SemiAutoRebalancer();
        }
        break;
      default:
        break;
      }
View Full Code Here

TOP

Related Classes of org.apache.helix.controller.rebalancer.SemiAutoRebalancer

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.