serverInfo.state = (liveInstances.contains(server)) ? "ONLINE" : "OFFLINE"; InstanceConfig config = zkHelixAdmin.getInstanceConfig(_clusterName, server); serverInfo.tags = config.getRecord().getListField("TAG_LIST"); clusterInfo.addServerInfo(serverInfo); brokerInfo.state = (liveInstances.contains(server)) ? "ONLINE" : "OFFLINE"; InstanceConfig config = zkHelixAdmin.getInstanceConfig(_clusterName, server); brokerInfo.tags = config.getRecord().getListField("TAG_LIST"); clusterInfo.addBrokerInfo(brokerInfo);
private static List<String> getListValue(ZNRecord record, String key) { if (record == null) { return null; } return record.getListField(key); }
/** * Get the preference list of a partition * @param partitionName the name of the partition * @return a list of instances that can serve replicas of the partition */ public List<String> getPreferenceList(String partitionName) { List<String> instanceStateList = _record.getListField(partitionName); if (instanceStateList != null) { return instanceStateList; } return null; }
private static List<String> getListValue(ZNRecord record, String key) { if (record == null) { return null; } return record.getListField(key); }
/** * Get the preference list of a partition * @param partitionName the name of the partition * @return a list of instances that can serve replicas of the partition */ public List<String> getPreferenceList(String partitionName) { List<String> instanceStateList = _record.getListField(partitionName); if (instanceStateList != null) { return instanceStateList; } return null; }
/** * Get the user-specified preference list of a partition * @param partitionName the name of the partition * @return a list of instances that can serve replicas of the partition */ public List<String> getPreferenceList(String partitionName) { List<String> instanceStateList = _record.getListField(partitionName); if (instanceStateList != null) { return instanceStateList; } return null; }
public SemiAutoModeISBuilder assignPreferenceList(String partitionName, String... instanceNames) { add(partitionName); _record.getListField(partitionName).addAll(Arrays.asList(instanceNames)); return this; } }
public void add(String partitionName) { if (_record.getListField(partitionName) == null) { _record.setListField(partitionName, new ArrayList<String>()); } }
public AutoModeISBuilder assignPreferenceList(String partitionName, String... instanceNames) { add(partitionName); _record.getListField(partitionName).addAll(Arrays.asList(instanceNames)); return this; }
/** * Get history list * @return */ public List<String> getHistoryList() { List<String> historyList = _record.getListField(ConfigProperty.HISTORY.name()); if (historyList == null) { historyList = new ArrayList<String>(); } return historyList; }
/** * Get a list of partitions associated with this message * @return list of partition names */ public List<String> getPartitionNames() { List<String> partitionNames = _record.getListField(Attributes.PARTITION_NAME.toString()); if (partitionNames == null) { return Collections.emptyList(); } return partitionNames; }
/** * Whether there are any relay message attached to this message. * * @return */ public boolean hasRelayMessages() { List<String> relayHosts = _record.getListField(Attributes.RELAY_PARTICIPANTS.name()); return (relayHosts != null && relayHosts.size() > 0); }
public SemiAutoModeISBuilder assignPreferenceList(String partitionName, String... instanceNames) { add(partitionName); _record.getListField(partitionName).addAll(Arrays.asList(instanceNames)); return this; } }
public SemiAutoModeISBuilder add(String partitionName) { if (_record.getListField(partitionName) == null) { _record.setListField(partitionName, new ArrayList<String>()); } return this; }
/** * Add a partition, Helix will automatically assign the placement and state * for this partition at runtime. * @param partitionName */ public AutoRebalanceModeISBuilder add(String partitionName) { if (_record.getListField(partitionName) == null) { _record.setListField(partitionName, new ArrayList<String>()); } return this; } }
/** * Add a partition, Helix will automatically assign the placement and state * for this partition at runtime. * @param partitionName */ public FullAutoModeISBuilder add(String partitionName) { if (_record.getListField(partitionName) == null) { _record.setListField(partitionName, new ArrayList<String>()); } return this; } }
/** * Add a partition, Helix will automatically assign the placement and state * for this partition at runtime. * @param partitionName */ public AutoRebalanceModeISBuilder add(String partitionName) { if (_record.getListField(partitionName) == null) { _record.setListField(partitionName, new ArrayList<String>()); } return this; } }
/** * Get arbitrary tags associated with the instance * @return a list of tags */ public List<String> getTags() { List<String> tags = getRecord().getListField(InstanceConfigProperty.TAG_LIST.toString()); if (tags == null) { tags = new ArrayList<String>(0); } return tags; }
/** * Get arbitrary tags associated with the instance * @return a list of tags */ public List<String> getTags() { List<String> tags = getRecord().getListField(InstanceConfigProperty.TAG_LIST.toString()); if (tags == null) { tags = new ArrayList<String>(0); } return tags; }
/** * Check if an instance contains a tag * @param tag the tag to check * @return true if the instance contains the tag, false otherwise */ public boolean containsTag(String tag) { List<String> tags = getRecord().getListField(InstanceConfigProperty.TAG_LIST.toString()); if (tags == null) { return false; } return tags.contains(tag); }