ClusterAccessor clusterAccessor = new ClusterAccessor(clusterId, accessor, _cache);
Cluster cluster = clusterAccessor.readCluster();
// 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();
for (Participant participant : cluster.getParticipantMap().values()) {
instanceSet.add(participant.getId().toString());
if (participant.isAlive()) {
liveInstanceSet.add(participant.getId().toString());
}
if (!participant.isEnabled()) {
disabledInstanceSet.add(participant.getId().toString());
}
Set<String> partitionNames = Sets.newHashSet();
for (PartitionId partitionId : participant.getDisabledPartitionIds()) {
partitionNames.add(partitionId.toString());
}
disabledPartitions.put(participant.getId().toString(), partitionNames);
tags.put(participant.getId().toString(), participant.getTags());
}
clusterStatusMonitor.setClusterInstanceStatus(liveInstanceSet, instanceSet,
disabledInstanceSet, disabledPartitions, tags);
}
event.addAttribute("Cluster", cluster);
event.addAttribute("ClusterDataCache", _cache);