You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Wenjun Ruan (Jira)" <ji...@apache.org> on 2021/09/19 13:55:00 UTC
[jira] [Created] (ZOOKEEPER-4380) Avoid NPE in
RateLogger#rateLimitLog
Wenjun Ruan created ZOOKEEPER-4380:
--------------------------------------
Summary: Avoid NPE in RateLogger#rateLimitLog
Key: ZOOKEEPER-4380
URL: https://issues.apache.org/jira/browse/ZOOKEEPER-4380
Project: ZooKeeper
Issue Type: Improvement
Reporter: Wenjun Ruan
The newMsg may cause NPE
{code:java}
/**
* In addition to the message, it also takes a value.
*/
public void rateLimitLog(String newMsg, String value) {
long now = Time.currentElapsedTime();
if (newMsg.equals(msg)) {
++count;
this.value = value;
if (now - timestamp >= LOG_INTERVAL) {
flush();
msg = newMsg;
timestamp = now;
this.value = value;
}
} else {
flush();
msg = newMsg;
this.value = value;
timestamp = now;
LOG.warn("Message:{} Value:{}", msg, value);
}
}
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)