本文整理汇总了C#中Akka.Actor.Address.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Address.Equals方法的具体用法?C# Address.Equals怎么用?C# Address.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Akka.Actor.Address
的用法示例。
在下文中一共展示了Address.Equals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
}
}
示例2: Join
// Try to join this cluster node with the node specified by `address`.
// It's only allowed to join from an empty state, i.e. when not already a member.
// A `Join(selfUniqueAddress)` command is sent to the node to join,
// which will reply with a `Welcome` message.
public void Join(Address address)
{
if (address.Protocol != _cluster.SelfAddress.Protocol)
{
_log.Warning("Trying to join member with wrong protocol, but was ignored, expected [{0}] but was [{1}]",
_cluster.SelfAddress.Protocol, address.Protocol);
}
else if (address.System != _cluster.SelfAddress.System)
{
_log.Warning(
"Trying to join member with wrong ActorSystem name, but was ignored, expected [{0}] but was [{1}]",
_cluster.SelfAddress.System, address.System);
}
else
{
//TODO: Akka exception?
if (!_latestGossip.Members.IsEmpty) throw new InvalidOperationException("Join can only be done from an empty state");
// to support manual join when joining to seed nodes is stuck (no seed nodes available)
StopSeedNodeProcess();
if (address.Equals(_cluster.SelfAddress))
{
BecomeInitialized();
Joining(SelfUniqueAddress, _cluster.SelfRoles);
}
else
{
var joinDeadline = _cluster.Settings.RetryUnsuccessfulJoinAfter == null
? null
: Deadline.Now + _cluster.Settings.RetryUnsuccessfulJoinAfter;
Context.Become(m => TryingToJoin(m, address, joinDeadline));
ClusterCore(address).Tell(new InternalClusterAction.Join(_cluster.SelfUniqueAddress, _cluster.SelfRoles));
}
}
}
示例3: GetExternalAddressFor
public override Address GetExternalAddressFor(Address address)
{
return address.Equals(RootPath.Address) ? address : null;
}