当前位置: 首页>>代码示例>>C#>>正文


C# UniqueAddress.Equals方法代码示例

本文整理汇总了C#中UniqueAddress.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# UniqueAddress.Equals方法的具体用法?C# UniqueAddress.Equals怎么用?C# UniqueAddress.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UniqueAddress的用法示例。


在下文中一共展示了UniqueAddress.Equals方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ValidNodeForGossip

 public bool ValidNodeForGossip(UniqueAddress node)
 {
     return !node.Equals(SelfUniqueAddress) && _latestGossip.HasMember(node) &&
             _latestGossip.ReachabilityExcludingDownedObservers.IsReachable(node);
 }
开发者ID:MaciekLesiczka,项目名称:akka.net,代码行数:5,代码来源:ClusterDaemon.cs

示例2: Welcome

 //Reply from Join request
 public void Welcome(Address joinWith, UniqueAddress from, Gossip gossip)
 {
     if (!_latestGossip.Members.IsEmpty) throw new InvalidOperationException("Welcome can only be done from an empty state");
     if (!joinWith.Equals(from.Address))
     {
         _log.Info("Ignoring welcome from [{0}] when trying to join with [{1}]", from.Address, joinWith);
     }
     else
     {
         _log.Info("Welcome from [{0}]", from.Address);
         _latestGossip = gossip.Seen(SelfUniqueAddress);
         Publish(_latestGossip);
         if (!from.Equals(SelfUniqueAddress))
             GossipTo(from, Sender);
         BecomeInitialized();
     }
 }
开发者ID:MaciekLesiczka,项目名称:akka.net,代码行数:18,代码来源:ClusterDaemon.cs

示例3: Joining

        //State transition to JOINING - new node joining.
        //Received `Join` message and replies with `Welcome` message, containing
        // current gossip state, including the new joining member.
        public void Joining(UniqueAddress node, ImmutableHashSet<string> roles)
        {
            if(node.Address.Protocol != _cluster.SelfAddress.Protocol)
            {
                _log.Warning("Member with wrong protocol tried to join, but was ignored, expected [{0}] but was [{1}]",
                    _cluster.SelfAddress.Protocol, node.Address.Protocol);
            }
            else if (node.Address.System != _cluster.SelfAddress.System)
            {
                _log.Warning(
                    "Member with wrong ActorSystem name tried to join, but was ignored, expected [{0}] but was [{1}]",
                    _cluster.SelfAddress.System, node.Address.System);
            }
            else
            {
                var localMembers = _latestGossip.Members;

                // check by address without uid to make sure that node with same host:port is not allowed
                // to join until previous node with that host:port has been removed from the cluster
                var alreadyMember = localMembers.Any(m => m.Address == node.Address);
                var isUnreachable = !_latestGossip.Overview.Reachability.IsReachable(node);

                if (alreadyMember) _log.Info("Existing member [{0}] is trying to join, ignoring", node);
                else if (isUnreachable) _log.Info("Unreachable member [{0}] is trying to join, ignoring", node);
                else
                {
                    // remove the node from the failure detector
                    _cluster.FailureDetector.Remove(node.Address);

                    // add joining node as Joining
                    // add self in case someone else joins before self has joined (Set discards duplicates)
                    var newMembers = localMembers
                            .Add(Member.Create(node, roles))
                            .Add(Member.Create(_cluster.SelfUniqueAddress, _cluster.SelfRoles));

                    var newGossip = _latestGossip.Copy(members: newMembers);

                    UpdateLatestGossip(newGossip);

                    _log.Info("Node [{0}] is JOINING, roles [{1}]", node.Address,
                        roles.Select(r => r.ToString()).Aggregate("", (a, b) => a + ", " + b));

                    if (!node.Equals(SelfUniqueAddress))
                    {
                        Sender.Tell(new InternalClusterAction.Welcome(SelfUniqueAddress, _latestGossip));
                    }

                    Publish(_latestGossip);
                }
            }
        }
开发者ID:rodrigovidal,项目名称:akka.net,代码行数:54,代码来源:ClusterDaemon.cs

示例4: Joining

        // State transition to JOINING - new node joining.
        // Received `Join` message and replies with `Welcome` message, containing
        // current gossip state, including the new joining member.
        public void Joining(UniqueAddress node, ImmutableHashSet<string> roles)
        {
            if (node.Address.Protocol != _cluster.SelfAddress.Protocol)
            {
                _log.Warning("Member with wrong protocol tried to join, but was ignored, expected [{0}] but was [{1}]",
                    _cluster.SelfAddress.Protocol, node.Address.Protocol);
            }
            else if (node.Address.System != _cluster.SelfAddress.System)
            {
                _log.Warning(
                    "Member with wrong ActorSystem name tried to join, but was ignored, expected [{0}] but was [{1}]",
                    _cluster.SelfAddress.System, node.Address.System);
            }
            else
            {
                var localMembers = _latestGossip.Members;
                var localMember = localMembers.FirstOrDefault(m => m.Address == node.Address);

                if (localMember != null && localMember.UniqueAddress == node)
                {
                    _log.Info("Existing member [{0}] is joining again.", node);
                    if (!node.Equals(SelfUniqueAddress))
                    {
                        Sender.Tell(new InternalClusterAction.Welcome(SelfUniqueAddress, _latestGossip));
                    }
                }
                else if (localMember != null)
                {
                    _log.Info("New incarnation of existing member [{0}] is trying to join. " +
                        "Existing will be removed from the cluster and then new member will be allowed to join.", node);
                    if (localMember.Status != MemberStatus.Down && localMember.Status != MemberStatus.Leaving && localMember.Status != MemberStatus.Exiting)
                        Downing(localMember.Address);
                }
                else
                {
                    // remove the node from the failure detector
                    _cluster.FailureDetector.Remove(node.Address);

                    // add joining node as Joining
                    // add self in case someone else joins before self has joined (Set discards duplicates)
                    var newMembers = localMembers
                            .Add(Member.Create(node, roles))
                            .Add(Member.Create(_cluster.SelfUniqueAddress, _cluster.SelfRoles));

                    var newGossip = _latestGossip.Copy(members: newMembers);

                    UpdateLatestGossip(newGossip);

                    _log.Info("Node [{0}] is JOINING, roles [{1}]", node.Address, string.Join(",", roles));

                    if (!node.Equals(SelfUniqueAddress))
                    {
                        Sender.Tell(new InternalClusterAction.Welcome(SelfUniqueAddress, _latestGossip));
                    }

                    Publish(_latestGossip);
                }
            }
        }
开发者ID:MaciekLesiczka,项目名称:akka.net,代码行数:62,代码来源:ClusterDaemon.cs

示例5: ValidNodeForGossip

 public bool ValidNodeForGossip(UniqueAddress node)
 {
     return !node.Equals(SelfUniqueAddress) && _latestGossip.HasMember(node) &&
             _latestGossip.Overview.Reachability.IsReachable(node);
 }
开发者ID:rodrigovidal,项目名称:akka.net,代码行数:5,代码来源:ClusterDaemon.cs


注:本文中的UniqueAddress.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。