You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2020/03/05 06:44:50 UTC

[GitHub] [zookeeper] maoling commented on a change in pull request #1275: Zookeeper-3735: fix the bad format of RATE_LOGGER

maoling commented on a change in pull request #1275: Zookeeper-3735: fix the bad format of RATE_LOGGER
URL: https://github.com/apache/zookeeper/pull/1275#discussion_r388101859
 
 

 ##########
 File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/RateLogger.java
 ##########
 @@ -65,14 +65,29 @@ public void rateLimitLog(String newMsg) {
     }
 
     /**
-     * In addition to the message, it also takes a value.
+     * Any new message is logged once to the underlying logger.
+     *
+     *
+     * If subsequent messages remain the same as the previous
+     * they are not logged unless a specified time interval has elapsed.
+     * A subsequent message that is different to the previous also logs the
+     * previous message.
+     * At any time the current message can be logged using {@link #flush()}.
+     * <p>
+     * Messages are written to log with format '
+     *
+     *
+     * @param newMsg the message to log;
+     * @param value the value provided while logging the message
+     *                     message value; Optional
      */
     public void rateLimitLog(String newMsg, String value) {
         long now = Time.currentElapsedTime();
         if (newMsg.equals(msg)) {
             ++count;
-            this.value = value;
+            this.value = value;  // should this go in an else block?
             if (now - timestamp >= LOG_INTERVAL) {
+                // log previous message and value
                 flush();
                 msg = newMsg;
 
 Review comment:
   Why do you need this change? Time interval has elapsed, reset count?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services