本文整理汇总了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);
}
示例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();
}
}
示例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);
}
}
}
示例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);
}
}
}
示例5: ValidNodeForGossip
public bool ValidNodeForGossip(UniqueAddress node)
{
return !node.Equals(SelfUniqueAddress) && _latestGossip.HasMember(node) &&
_latestGossip.Overview.Reachability.IsReachable(node);
}