joerghoh commented on code in PR #201:
URL:
https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/201#discussion_r2309605721
##########
src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java:
##########
@@ -776,21 +783,46 @@ private boolean drainSpecificQueue(boolean isAlias,
List<Map.Entry<String, Resou
new ChangeContext(type, path, isAlias, !isAlias),
resolverRefreshed, hasReloadedConfig);
}
+ if (count > 0) {
+ log.info(getTimingMessage(message, sw.getDuration(), count));
+ }
+
// do we need to send an event?
return sendEvent;
}
// Drains the resource event queue for aliases
- private void drainAliasQueue() {
- if (drainSpecificQueue(true, resourceChangeQueueForAliases)) {
+ private void drainAliasQueue(String message) {
+ if (drainSpecificQueue(true, message, resourceChangeQueueForAliases)) {
sendChangeEvent();
}
}
// Drains the resource event queue for vanity paths
- private void drainVanityPathQueue() {
- if (drainSpecificQueue(false, resourceChangeQueueForVanityPaths)) {
+ private void drainVanityPathQueue(String message) {
+ if (drainSpecificQueue(false, message,
resourceChangeQueueForVanityPaths)) {
sendChangeEvent();
}
}
+
+ // builds a string based on (optional) message, duration, number of
operations
+ // computes and inserts the number of operations per second
+ static String getTimingMessage(String description, Duration duration, long
operations) {
Review Comment:
optional sounds like you can also provide a ``null`` value, but I am not
sure if the StringBuilder accepts a ``null`` as a parameter in the constructor.
For that reason I would make it mandatory and not-null.
```suggestion
// builds a string based on message, duration, number of operations
// computes and inserts the number of operations per second
static String getTimingMessage(@NotNull String description, Duration
duration, long operations) {
```
(and you might to harmonize the terms ```message``` and ```description``` in
the javadoc and the code; I don't have a preference.)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]