geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From u..@apache.org
Subject [5/6] incubator-geode git commit: GEODE-1874: Changed setNextNeighbor to not create HashMap for every p2p invocation
Date Mon, 07 Nov 2016 20:22:12 GMT
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/593c7025
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/593c7025
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/593c7025

Branch: refs/heads/develop
Commit: 593c7025f929819fde2e12ca05d24c6abe29b3a4
Parents: 5b0c565
Author: Udo Kohlmeyer <ukohlmeyer@pivotal.io>
Authored: Wed Oct 12 11:54:33 2016 +1100
Committer: Udo Kohlmeyer <ukohlmeyer@pivotal.io>
Committed: Tue Nov 8 07:09:19 2016 +1100

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


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/593c7025/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 b3598cd..97a413c 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,14 +374,15 @@ 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);
   }
 
 
@@ -833,7 +834,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);
@@ -1065,7 +1066,10 @@ public class GMSHealthMonitor implements HealthMonitor, MessageHandler
{
 
   private void processHeartbeat(HeartbeatMessage m) {
     this.stats.incHeartbeatsReceived();
-    if (m.getRequestId() >= 0) {
+    if (m.getRequestId() < 0) {
+      // a periodic heartbeat
+      contactedBy(m.getSender(), System.currentTimeMillis());
+    } else {
       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) {
@@ -1074,10 +1078,9 @@ 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());
   }
 
   /**


Mime
View raw message