qian0817 commented on PR #796:
URL: https://github.com/apache/ratis/pull/796#issuecomment-1342532896

   > Thanks a lot for working on this, @qian0817 !
   > 
   > +1 the change looks good.
   > 
   > Just found that 
`RaftServerMetricsImpl.followerLastHeartbeatElapsedTimeMap` should use a 
`ConcurrentHashMap`. Could you also change it?
   > 
   > ```java
   > +++ 
b/ratis-server/src/main/java/org/apache/ratis/server/metrics/RaftServerMetricsImpl.java
   > @@ -20,7 +20,6 @@ package org.apache.ratis.server.metrics;
   >  
   >  import java.util.Optional;
   >  import java.util.concurrent.ConcurrentHashMap;
   > -import java.util.HashMap;
   >  import java.util.Map;
   >  import java.util.function.Function;
   >  import java.util.function.Supplier;
   > @@ -98,7 +97,7 @@ public final class RaftServerMetricsImpl extends 
RatisMetrics implements RaftSer
   >        = newHeartbeatTimer(FOLLOWER_APPEND_ENTRIES_LATENCY);
   >  
   >    /** Follower Id -> heartbeat elapsed */
   > -  private final Map<RaftPeerId, Long> followerLastHeartbeatElapsedTimeMap 
= new HashMap<>();
   > +  private final Map<RaftPeerId, Long> followerLastHeartbeatElapsedTimeMap 
= new ConcurrentHashMap<>();
   >    private final Supplier<Function<RaftPeerId, CommitInfoProto>> 
commitInfoCache;
   >  
   >    /** id -> metric */
   > ```
   
   fix.


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

Reply via email to