Stop showing full list of resources on unregistration failure
Change-Id: I68108d3712999e38c3bab788314b10f91b056777
diff --git a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentResourceStore.java b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentResourceStore.java
index 7572406..70c9b5b 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentResourceStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentResourceStore.java
@@ -53,6 +53,7 @@
import java.util.Map;
import java.util.Optional;
import java.util.Set;
+import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -198,7 +199,13 @@
.collect(Collectors.toList());
notifyDelegate(events);
} else {
- log.warn("Failed to unregister {}: Commit failed.", ids, error);
+ String message = resources.stream()
+ .map(Resource::simpleTypeName)
+ .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))
+ .entrySet().stream()
+ .map(e -> String.format("%d %s type resources", e.getValue(), e.getKey()))
+ .collect(Collectors.joining(", "));
+ log.warn("Failed to unregister {}: Commit failed.", message, error);
}
}).join() == CommitStatus.SUCCESS;
}