Example #1
0
 protected override void PostStop()
 {
     foreach (var receiver in _state.ActiveReceivers)
     {
         FailureDetector.Remove(receiver.Address);
     }
     _heartbeatTask.Cancel();
     _cluster.Unsubscribe(Self);
 }
Example #2
0
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="node">TBD</param>
        /// <returns>TBD</returns>
        public ClusterHeartbeatSenderState RemoveMember(UniqueAddress node)
        {
            var newState = MembershipChange(Ring - node);

            FailureDetector.Remove(node.Address);
            if (newState.OldReceiversNowUnreachable.Contains(node))
            {
                return(newState.Copy(oldReceiversNowUnreachable: newState.OldReceiversNowUnreachable.Remove(node)));
            }
            return(newState);
        }
Example #3
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="from">TBD</param>
 /// <returns>TBD</returns>
 public ClusterHeartbeatSenderState HeartbeatRsp(UniqueAddress from)
 {
     if (ActiveReceivers.Contains(from))
     {
         FailureDetector.Heartbeat(from.Address);
         if (OldReceiversNowUnreachable.Contains(from))
         {
             //back from unreachable, ok to stop heartbeating to it
             if (!Ring.MyReceivers.Value.Contains(from))
             {
                 FailureDetector.Remove(from.Address);
             }
             return(Copy(oldReceiversNowUnreachable: OldReceiversNowUnreachable.Remove(from)));
         }
         return(this);
     }
     return(this);
 }
Example #4
0
        private ClusterHeartbeatSenderState MembershipChange(HeartbeatNodeRing newRing)
        {
            var oldReceivers     = Ring.MyReceivers.Value;
            var removedReceivers = oldReceivers.Except(newRing.MyReceivers.Value);
            var adjustedOldReceiversNowUnreachable = OldReceiversNowUnreachable;

            foreach (var r in removedReceivers)
            {
                if (FailureDetector.IsAvailable(r.Address))
                {
                    FailureDetector.Remove(r.Address);
                }
                else
                {
                    adjustedOldReceiversNowUnreachable = adjustedOldReceiversNowUnreachable.Add(r);
                }
            }
            return(Copy(newRing, adjustedOldReceiversNowUnreachable));
        }