private void PromoteElectedLeader(Id leaderNodeId) { if (_node.Id.Equals(leaderNodeId)) { // I've seen the leader get bumped out of its own // registry during a weird network partition or // something and it can never get back leadership // or even rejoin the cluster because it's missing // from the local registry _registry.Join(_node); _registry.DeclareLeaderAs(leaderNodeId); _registry.ConfirmAllLiveNodesByLeader(); } else { if (_registry.IsLeader(_node.Id)) { _registry.DemoteLeaderOf(_node.Id); } if (!_registry.HasMember(leaderNodeId)) { _registry.Join(_configuration.NodeMatching(leaderNodeId)); } _registry.DeclareLeaderAs(leaderNodeId); } }