use of org.apache.flink.runtime.leaderelection.LeaderInformationWithComponentId in project flink by apache.
the class KubernetesMultipleComponentLeaderElectionDriver method extractLeaderInformation.
private static Collection<LeaderInformationWithComponentId> extractLeaderInformation(KubernetesConfigMap configMap) {
final Map<String, String> data = configMap.getData();
final Collection<LeaderInformationWithComponentId> leaderInformationWithLeaderNames = new ArrayList<>();
for (Map.Entry<String, String> keyValuePair : data.entrySet()) {
final String key = keyValuePair.getKey();
if (KubernetesUtils.isSingleLeaderKey(key)) {
final String leaderName = KubernetesUtils.extractLeaderName(key);
final LeaderInformation leaderInformation = KubernetesUtils.parseLeaderInformationSafely(keyValuePair.getValue()).orElse(LeaderInformation.empty());
leaderInformationWithLeaderNames.add(LeaderInformationWithComponentId.create(leaderName, leaderInformation));
}
}
return leaderInformationWithLeaderNames;
}
Aggregations