cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [7/7] git commit: fix initializeNodeUnsafe
Date Fri, 09 Nov 2012 22:55:47 GMT
fix initializeNodeUnsafe


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/792bd184
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/792bd184
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/792bd184

Branch: refs/heads/cassandra-1.2
Commit: 792bd184f57407d2853cd7233c2732eacc551761
Parents: f5e3ae6
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Fri Nov 9 16:54:59 2012 -0600
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Fri Nov 9 16:54:59 2012 -0600

----------------------------------------------------------------------
 src/java/org/apache/cassandra/gms/Gossiper.java |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/792bd184/src/java/org/apache/cassandra/gms/Gossiper.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/Gossiper.java b/src/java/org/apache/cassandra/gms/Gossiper.java
index 5880210..1179815 100644
--- a/src/java/org/apache/cassandra/gms/Gossiper.java
+++ b/src/java/org/apache/cassandra/gms/Gossiper.java
@@ -389,7 +389,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
         EndpointState epState = endpointStateMap.get(endpoint);
         epState.updateTimestamp(); // make sure we don't evict it too soon
         epState.getHeartBeatState().forceNewerGenerationUnsafe();
-        epState.addApplicationState(ApplicationState.STATUS, StorageService.instance.valueFactory.removedNonlocal(hostId,computeExpireTime()));
+        epState.addApplicationState(ApplicationState.STATUS, StorageService.instance.valueFactory.removedNonlocal(hostId,
computeExpireTime()));
         logger.info("Completing removal of " + endpoint);
         endpointStateMap.put(endpoint, epState);
         // ensure at least one gossip round occurs before returning
@@ -1090,9 +1090,10 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
     public void initializeNodeUnsafe(InetAddress addr, UUID uuid, int generationNbr)
     {
         HeartBeatState hbState = new HeartBeatState(generationNbr);
-        EndpointState localState = new EndpointState(hbState);
-        localState.markAlive();
-        endpointStateMap.putIfAbsent(addr, localState);
+        EndpointState newState = new EndpointState(hbState);
+        newState.markAlive();
+        EndpointState oldState = endpointStateMap.putIfAbsent(addr, newState);
+        EndpointState localState = oldState == null ? newState : oldState;
 
         // always add the version state
         localState.addApplicationState(ApplicationState.NET_VERSION, StorageService.instance.valueFactory.networkVersion());


Mime
View raw message