iamaleksey commented on code in PR #2256:
URL: https://github.com/apache/cassandra/pull/2256#discussion_r1160578660


##########
src/java/org/apache/cassandra/utils/NoSpamLogger.java:
##########
@@ -218,6 +218,11 @@ private NoSpamLogger(Logger wrapped, long minInterval, 
TimeUnit timeUnit)
         minIntervalNanos = timeUnit.toNanos(minInterval);
     }
 
+    public static NoSpamLogger wrap(Logger wrapped, long minInterval, TimeUnit 
timeUnit)

Review Comment:
   Yes. Two reasons:
   
   1. I can just stash a reference to the wrapping `NoSpamLogger` in `Flusher` 
instead of doing an NBHM lookup every time in `NoSpamLogger#getLogger()` (which 
is not the end of the world by any means, but why?)
   2. And, most importantly, I can have the underlying wrapped `Logger` to be a 
`final static` one and share it between multiple instances of `NoSpamLogger`. 
`wrappedLoggers` map inside `NoSpamLogger` is keyed by `Logger`, so without 
bypassing it you'll only ever have one instance of `NoSpamLogger` per instance 
of `Logger`. It's important for  different instance of `Flusher` (and, 
consequently, of `Journal`) to coexist at runtime, for we are going to have 
multiple users of `Journal` eventually, if all goes as planned (`Journal` will 
replace hints storage layer and possibly hints + commitlog in one in hopefully 
near future).



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to