rombert commented on code in PR #33:
URL:
https://github.com/apache/sling-org-apache-sling-commons-log/pull/33#discussion_r3381479484
##########
src/main/java/org/apache/sling/commons/log/logback/store/package-info.java:
##########
@@ -23,7 +23,7 @@
* <p>The API is intentionally decoupled from slf4j and logback to prevent
binding to those APIs
* directly, which hinders evolution and is problematic when upgrading
dependency versions.</p>
*/
-@Version("1.0.0")
+@Version("2.0.0")
Review Comment:
Now this we must avoid :-)
##########
src/main/java/org/apache/sling/commons/log/logback/internal/store/LogStoreImpl.java:
##########
@@ -47,6 +51,23 @@ public void append(LogEntry snapshot) {
entries.addLast(snapshot);
trimToSize();
}
+ // Notify listeners outside the lock so a slow or re-entrant listener
does
+ // not stall other producers waiting to append.
+ for (LogEntryListener listener : listeners) {
+ listener.onEntry(snapshot);
+ }
+ }
+
+ public void addListener(LogEntryListener listener) {
+ if (listener != null) {
+ listeners.add(listener);
+ }
+ }
+
+ public void removeListener(LogEntryListener listener) {
+ if (listener != null) {
Review Comment:
Would it make sense to fail if the listener is `null` instead?
##########
src/main/java/org/apache/sling/commons/log/logback/internal/store/LogStoreImpl.java:
##########
@@ -47,6 +51,23 @@ public void append(LogEntry snapshot) {
entries.addLast(snapshot);
trimToSize();
}
+ // Notify listeners outside the lock so a slow or re-entrant listener
does
+ // not stall other producers waiting to append.
+ for (LogEntryListener listener : listeners) {
+ listener.onEntry(snapshot);
+ }
+ }
+
+ public void addListener(LogEntryListener listener) {
+ if (listener != null) {
Review Comment:
Would it make sense to fail if the listener is `null` instead?
--
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]