HDDS-1476. Fix logIfNeeded logic in EndPointStateMachine. (#779)

This commit is contained in:
Siddharth 2019-04-29 12:05:38 -07:00 committed by Bharat Viswanadham
parent a96d16a843
commit 5bca062d0e

View File

@ -200,16 +200,15 @@ public String toString() {
* @param ex - Exception * @param ex - Exception
*/ */
public void logIfNeeded(Exception ex) { public void logIfNeeded(Exception ex) {
LOG.trace("Incrementing the Missed count. Ex : {}", ex); if (this.getMissedCount() % getLogWarnInterval(conf) == 0) {
this.incMissed();
if (this.getMissedCount() % getLogWarnInterval(conf) ==
0) {
LOG.error( LOG.error(
"Unable to communicate to SCM server at {} for past {} seconds.", "Unable to communicate to SCM server at {} for past {} seconds.",
this.getAddress().getHostString() + ":" + this.getAddress().getPort(), this.getAddress().getHostString() + ":" + this.getAddress().getPort(),
TimeUnit.MILLISECONDS.toSeconds( TimeUnit.MILLISECONDS.toSeconds(
this.getMissedCount() * getScmHeartbeatInterval(this.conf)), ex); this.getMissedCount() * getScmHeartbeatInterval(this.conf)), ex);
} }
LOG.trace("Incrementing the Missed count. Ex : {}", ex);
this.incMissed();
} }