Package org.apache.helix.controller.stages

Examples of org.apache.helix.controller.stages.ClusterEvent.addAttribute()


   * @throws Exception
   */

  static BestPossibleStateOutput calcBestPossState(ClusterDataCache cache) throws Exception {
    ClusterEvent event = new ClusterEvent("sampleEvent");
    event.addAttribute("ClusterDataCache", cache);

    ResourceComputationStage rcState = new ResourceComputationStage();
    CurrentStateComputationStage csStage = new CurrentStateComputationStage();
    BestPossibleStateCalcStage bpStage = new BestPossibleStateCalcStage();

View Full Code Here


    stage.postProcess();
  }

  BestPossibleStateOutput calculateBestPossibleState(Cluster cluster) throws Exception {
    ClusterEvent event = new ClusterEvent("event");
    event.addAttribute("Cluster", cluster);

    List<Stage> stages = new ArrayList<Stage>();
    stages.add(new ResourceComputationStage());
    stages.add(new CurrentStateComputationStage());
    stages.add(new BestPossibleStateCalcStage());
View Full Code Here

    public void run() {
      _cache.requireFullRefresh();
      NotificationContext changeContext = new NotificationContext(_manager);
      changeContext.setType(NotificationContext.Type.CALLBACK);
      ClusterEvent event = new ClusterEvent("periodicalRebalance");
      event.addAttribute("helixmanager", changeContext.getManager());
      event.addAttribute("changeContext", changeContext);
      List<ZNRecord> dummy = new ArrayList<ZNRecord>();
      event.addAttribute("eventData", dummy);
      // Should be able to process
      _eventQueue.put(event);
View Full Code Here

      _cache.requireFullRefresh();
      NotificationContext changeContext = new NotificationContext(_manager);
      changeContext.setType(NotificationContext.Type.CALLBACK);
      ClusterEvent event = new ClusterEvent("periodicalRebalance");
      event.addAttribute("helixmanager", changeContext.getManager());
      event.addAttribute("changeContext", changeContext);
      List<ZNRecord> dummy = new ArrayList<ZNRecord>();
      event.addAttribute("eventData", dummy);
      // Should be able to process
      _eventQueue.put(event);
    }
View Full Code Here

      changeContext.setType(NotificationContext.Type.CALLBACK);
      ClusterEvent event = new ClusterEvent("periodicalRebalance");
      event.addAttribute("helixmanager", changeContext.getManager());
      event.addAttribute("changeContext", changeContext);
      List<ZNRecord> dummy = new ArrayList<ZNRecord>();
      event.addAttribute("eventData", dummy);
      // Should be able to process
      _eventQueue.put(event);
    }
  }
View Full Code Here

    // Set up the event
    ClusterAccessor clusterAccessor = new ClusterAccessor(_clusterId, _dataAccessor);
    Cluster cluster = clusterAccessor.readCluster();
    ClusterEvent event = new ClusterEvent(testName);
    event.addAttribute(AttributeName.CURRENT_STATE.toString(), new ResourceCurrentState());
    Map<ResourceId, ResourceConfig> resourceConfigMap =
        Maps.transformValues(cluster.getResourceMap(), new Function<Resource, ResourceConfig>() {
          @Override
          public ResourceConfig apply(Resource resource) {
            return resource.getConfig();
View Full Code Here

          @Override
          public ResourceConfig apply(Resource resource) {
            return resource.getConfig();
          }
        });
    event.addAttribute(AttributeName.RESOURCES.toString(), resourceConfigMap);
    event.addAttribute("Cluster", cluster);

    // Run the stage
    try {
      new BestPossibleStateCalcStage().process(event);
View Full Code Here

          public ResourceConfig apply(Resource resource) {
            return resource.getConfig();
          }
        });
    event.addAttribute(AttributeName.RESOURCES.toString(), resourceConfigMap);
    event.addAttribute("Cluster", cluster);

    // Run the stage
    try {
      new BestPossibleStateCalcStage().process(event);
    } catch (Exception e) {
View Full Code Here

  }

  static BestPossibleStateOutput calcBestPossState(Cluster cluster, Set<String> resources)
      throws Exception {
    ClusterEvent event = new ClusterEvent("sampleEvent");
    event.addAttribute("Cluster", cluster);

    ResourceComputationStage rcState = new ResourceComputationStage();
    CurrentStateComputationStage csStage = new CurrentStateComputationStage();
    BestPossibleStateCalcStage bpStage = new BestPossibleStateCalcStage();
View Full Code Here

    logger.info("START: GenericClusterController.onStateChange()");
    if (changeContext == null || changeContext.getType() != Type.CALLBACK) {
      _cache.requireFullRefresh();
    }
    ClusterEvent event = new ClusterEvent("currentStateChange");
    event.addAttribute("helixmanager", changeContext.getManager());
    event.addAttribute("instanceName", instanceName);
    event.addAttribute("changeContext", changeContext);
    event.addAttribute("eventData", statesInfo);
    _eventQueue.put(event);
    logger.info("END: GenericClusterController.onStateChange()");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.