Package org.apache.helix.monitoring.mbeans

Examples of org.apache.helix.monitoring.mbeans.ClusterStatusMonitor


      throw new StageException("HelixManager attribute value is null");
    }
    HelixDataAccessor dataAccessor = manager.getHelixDataAccessor();
    _cache.refresh(dataAccessor);
   
    ClusterStatusMonitor clusterStatusMonitor = (ClusterStatusMonitor) event.getAttribute("clusterStatusMonitor");
    if(clusterStatusMonitor != null)
    {
      int disabledInstances = 0;
      int disabledPartitions = 0;
      for(InstanceConfig  config : _cache._instanceConfigMap.values())
      {
        if(config.getInstanceEnabled() == false)
        {
          disabledInstances ++;
        }
        if(config.getDisabledPartitionMap() != null)
        {
          disabledPartitions += config.getDisabledPartitionMap().size();
        }
      }
      clusterStatusMonitor.setClusterStatusCounters(_cache._liveInstanceMap.size(), _cache._instanceConfigMap.size(),
          disabledInstances, disabledPartitions);
    }

    event.addAttribute("ClusterDataCache", _cache);
   
View Full Code Here


            // }
          }
        }
      }
      // Update cluster status monitor mbean
      ClusterStatusMonitor clusterStatusMonitor =
          (ClusterStatusMonitor) event.getAttribute("clusterStatusMonitor");
      if (clusterStatusMonitor != null)
      {
        clusterStatusMonitor.onExternalViewChange(view,
                                                  cache._idealStateMap.get(view.getResourceName()));
      }

      // compare the new external view with current one, set only on different
      Map<String, ExternalView> curExtViews =
View Full Code Here

      }
      else
      {
        if (_clusterStatusMonitor == null)
        {
          _clusterStatusMonitor = new ClusterStatusMonitor(manager.getClusterName());
        }
       
        event.addAttribute("clusterStatusMonitor", _clusterStatusMonitor);
      }
    }
View Full Code Here

      throw new StageException("HelixManager attribute value is null");
    }
    HelixDataAccessor dataAccessor = manager.getHelixDataAccessor();
    _cache.refresh(dataAccessor);

    ClusterStatusMonitor clusterStatusMonitor =
        (ClusterStatusMonitor) event.getAttribute("clusterStatusMonitor");
    if (clusterStatusMonitor != null) {
      int disabledInstances = 0;
      int disabledPartitions = 0;
      for (InstanceConfig config : _cache._instanceConfigMap.values()) {
        if (config.getInstanceEnabled() == false) {
          disabledInstances++;
        }
        if (config.getDisabledPartitions() != null) {
          disabledPartitions += config.getDisabledPartitions().size();
        }
      }
      clusterStatusMonitor.setClusterStatusCounters(_cache._liveInstanceMap.size(),
          _cache._instanceConfigMap.size(), disabledInstances, disabledPartitions);
    }

    event.addAttribute("ClusterDataCache", _cache);
View Full Code Here

        stopRebalancingTimer();
        logger.info("Get FINALIZE notification, skip the pipeline. Event :" + event.getName());
        return;
      } else {
        if (_clusterStatusMonitor == null) {
          _clusterStatusMonitor = new ClusterStatusMonitor(manager.getClusterName());
        }

        event.addAttribute("clusterStatusMonitor", _clusterStatusMonitor);
      }
    }
View Full Code Here

        stopRebalancingTimer();
        logger.info("Get FINALIZE notification, skip the pipeline. Event :" + event.getName());
        return;
      } else {
        if (_clusterStatusMonitor == null) {
          _clusterStatusMonitor = new ClusterStatusMonitor(manager.getClusterName());
        }

        event.addAttribute("clusterStatusMonitor", _clusterStatusMonitor);
      }
    }
View Full Code Here

            // }
          }
        }
      }
      // Update cluster status monitor mbean
      ClusterStatusMonitor clusterStatusMonitor =
          (ClusterStatusMonitor) event.getAttribute("clusterStatusMonitor");
      IdealState idealState = cache._idealStateMap.get(view.getResourceName());
      if (idealState != null) {
        if (clusterStatusMonitor != null
            && !idealState.getStateModelDefRef().equalsIgnoreCase(
                DefaultSchedulerMessageHandlerFactory.SCHEDULER_TASK_QUEUE)) {
          clusterStatusMonitor.onExternalViewChange(view,
              cache._idealStateMap.get(view.getResourceName()));
        }
      }

      // compare the new external view with current one, set only on different
View Full Code Here

    HelixDataAccessor dataAccessor = manager.getHelixDataAccessor();
    _cache.refresh(dataAccessor);

    // Update the cluster status gauges
    ClusterStatusMonitor clusterStatusMonitor =
        (ClusterStatusMonitor) event.getAttribute("clusterStatusMonitor");
    if (clusterStatusMonitor != null) {
      Set<String> instanceSet = Sets.newHashSet();
      Set<String> liveInstanceSet = Sets.newHashSet();
      Set<String> disabledInstanceSet = Sets.newHashSet();
      Map<String, Set<String>> disabledPartitions = Maps.newHashMap();
      Map<String, Set<String>> tags = Maps.newHashMap();
      Map<String, LiveInstance> liveInstanceMap = _cache.getLiveInstances();
      for (Map.Entry<String, InstanceConfig> e : _cache.getInstanceConfigMap().entrySet()) {
        String instanceName = e.getKey();
        InstanceConfig config = e.getValue();
        instanceSet.add(instanceName);
        if (liveInstanceMap.containsKey(instanceName)) {
          liveInstanceSet.add(instanceName);
        }
        if (!config.getInstanceEnabled()) {
          disabledInstanceSet.add(instanceName);
        }
        List<String> disabledPartitionsList = config.getDisabledPartitions();
        Set<String> partitionNames =
            disabledPartitionsList != null ? new HashSet<String>(config.getDisabledPartitions())
                : new HashSet<String>();
        disabledPartitions.put(instanceName, partitionNames);
        Set<String> instanceTags = Sets.newHashSet(config.getTags());
        tags.put(instanceName, instanceTags);
      }
      clusterStatusMonitor.setClusterInstanceStatus(liveInstanceSet, instanceSet,
          disabledInstanceSet, disabledPartitions, tags);
    }

    event.addAttribute("ClusterDataCache", _cache);
View Full Code Here

        stopRebalancingTimer();
        logger.info("Get FINALIZE notification, skip the pipeline. Event :" + event.getName());
        return;
      } else {
        if (_clusterStatusMonitor == null) {
          _clusterStatusMonitor = new ClusterStatusMonitor(manager.getClusterName());
        }

        event.addAttribute("clusterStatusMonitor", _clusterStatusMonitor);
      }
    }
View Full Code Here

    BestPossibleStateOutput bestPossibleStateOutput =
        compute(cluster, event, resourceMap, currentStateOutput);
    event.addAttribute(AttributeName.BEST_POSSIBLE_STATE.toString(), bestPossibleStateOutput);

    try {
      ClusterStatusMonitor clusterStatusMonitor =
          (ClusterStatusMonitor) event.getAttribute("clusterStatusMonitor");
      if (clusterStatusMonitor != null) {
        clusterStatusMonitor.setPerInstanceResourceStatus(bestPossibleStateOutput,
            cache.getInstanceConfigMap(), resourceMap, cache.getStateModelDefMap());
      }
    } catch (Exception e) {
      LOG.error("Could not update cluster status metrics!", e);
    }
View Full Code Here

TOP

Related Classes of org.apache.helix.monitoring.mbeans.ClusterStatusMonitor

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.