for (Cluster cluster : clusters) {
Stack stack = stackRepository.findStackForCluster(cluster.getId());
if (stack != null) {
Long uptime = cluster.getCreationFinished() == null ? 0L : now - cluster.getCreationFinished();
if (uptimes.containsKey(stack.getOwner())) {
uptimes.get(stack.getOwner()).add(new UptimeMessage(stack.getId(), uptime));
} else {
uptimes.put(stack.getOwner(), new ArrayList<UptimeMessage>());
uptimes.get(stack.getOwner()).add(new UptimeMessage(stack.getId(), uptime));
}
}
}
if (!uptimes.isEmpty()) {
for (Map.Entry<String, List<UptimeMessage>> longListEntry : uptimes.entrySet()) {