Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-1874 edaa462eb -> fb725edbc


GEODE-1874: Changed setNextNeighbor to not create HashMap for every p2p 
invocation


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/fb725edb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/fb725edb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/fb725edb

Branch: refs/heads/feature/GEODE-1874
Commit: fb725edbc3dfa4897b7e7916431c7bf5a2456678
Parents: edaa462
Author: Udo Kohlmeyer <ukohlme...@pivotal.io>
Authored: Thu Oct 13 10:46:44 2016 +1100
Committer: Udo Kohlmeyer <ukohlme...@pivotal.io>
Committed: Thu Oct 13 10:46:44 2016 +1100

----------------------------------------------------------------------
 .../internal/membership/gms/fd/GMSHealthMonitor.java | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/fb725edb/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
 
b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
index 97a413c..b3598cd 100644
--- 
a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
+++ 
b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
@@ -374,15 +374,14 @@ public class GMSHealthMonitor implements HealthMonitor, 
MessageHandler {
    */
   private void contactedBy(InternalDistributedMember sender, long timeStamp) {
     TimeStamp cTS = new TimeStamp(timeStamp);
-    //TODO Udo: why putIfAbsent. Surely only put is required
     cTS = memberTimeStamps.putIfAbsent(sender, cTS);
     if (cTS != null && cTS.getTime() < timeStamp) {
       cTS.setTime(timeStamp);
     }
     if (suspectedMemberInView.remove(sender) != null) {
       logger.info("No longer suspecting {}", sender);
+      setNextNeighbor(currentView, null);
     }
-    setNextNeighbor(currentView, null);
   }
 
 
@@ -834,7 +833,7 @@ public class GMSHealthMonitor implements HealthMonitor, 
MessageHandler {
     }
 
     List<InternalDistributedMember> allMembers = newView.getMembers();
-
+    //
     //    Set<InternalDistributedMember> checkAllSuspected = new 
HashSet<>(allMembers);
     //    checkAllSuspected.removeAll(suspectedMemberInView.keySet());
     //    checkAllSuspected.remove(localAddress);
@@ -1066,10 +1065,7 @@ public class GMSHealthMonitor implements HealthMonitor, 
MessageHandler {
 
   private void processHeartbeat(HeartbeatMessage m) {
     this.stats.incHeartbeatsReceived();
-    if (m.getRequestId() < 0) {
-      // a periodic heartbeat
-      contactedBy(m.getSender(), System.currentTimeMillis());
-    } else {
+    if (m.getRequestId() >= 0) {
       Response resp = requestIdVsResponse.get(m.getRequestId());
       logger.trace("Got heartbeat from member {}. {}", m.getSender(), (resp != 
null ? "Check thread still waiting" : "Check thread is not waiting"));
       if (resp != null) {
@@ -1078,9 +1074,10 @@ public class GMSHealthMonitor implements HealthMonitor, 
MessageHandler {
           resp.notify();
         }
       }
-      //we got heartbeat lets update timestamp
-      contactedBy(m.getSender(), System.currentTimeMillis());
+
     }
+    //we got heartbeat lets update timestamp
+    contactedBy(m.getSender(), System.currentTimeMillis());
   }
 
   /**

Reply via email to