本文整理汇总了C#中IInternalActorRef.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# IInternalActorRef.Equals方法的具体用法?C# IInternalActorRef.Equals怎么用?C# IInternalActorRef.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IInternalActorRef
的用法示例。
在下文中一共展示了IInternalActorRef.Equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendTerminated
private void SendTerminated(bool ifLocal, IInternalActorRef watcher)
{
if (((IActorRefScope)watcher).IsLocal == ifLocal && !watcher.Equals(Parent))
{
watcher.SendSystemMessage(new DeathWatchNotification(Self, true, false));
}
}
示例2: Dispatch
public void Dispatch(IInternalActorRef recipient, Address recipientAddress, SerializedMessage message,
IActorRef senderOption = null)
{
var payload = MessageSerializer.Deserialize(system, message);
Type payloadClass = payload == null ? null : payload.GetType();
var sender = senderOption ?? system.DeadLetters;
var originalReceiver = recipient.Path;
// message is intended for the RemoteDaemon, usually a command to create a remote actor
if (recipient.Equals(remoteDaemon))
{
if (settings.UntrustedMode) log.Debug("dropping daemon message in untrusted mode");
else
{
if (settings.LogReceive)
{
var msgLog = string.Format("RemoteMessage: {0} to {1}<+{2} from {3}", payload, recipient, originalReceiver,sender);
log.Debug("received daemon message [{0}]", msgLog);
}
remoteDaemon.Tell(payload);
}
}
//message is intended for a local recipient
else if ((recipient is ILocalRef || recipient is RepointableActorRef) && recipient.IsLocal)
{
if (settings.LogReceive)
{
var msgLog = string.Format("RemoteMessage: {0} to {1}<+{2} from {3}", payload, recipient, originalReceiver,sender);
log.Debug("received local message [{0}]", msgLog);
}
if (payload is ActorSelectionMessage)
{
var sel = (ActorSelectionMessage) payload;
var actorPath = "/" + string.Join("/", sel.Elements.Select(x => x.ToString()));
if (settings.UntrustedMode
&& (!settings.TrustedSelectionPaths.Contains(actorPath)
|| sel.Message is IPossiblyHarmful
|| !recipient.Equals(provider.RootGuardian)))
{
log.Debug(
"operating in UntrustedMode, dropping inbound actor selection to [{0}], allow it" +
"by adding the path to 'akka.remote.trusted-selection-paths' in configuration",
actorPath);
}
else
{
//run the receive logic for ActorSelectionMessage here to make sure it is not stuck on busy user actor
ActorSelection.DeliverSelection(recipient, sender, sel);
}
}
else if (payload is IPossiblyHarmful && settings.UntrustedMode)
{
log.Debug("operating in UntrustedMode, dropping inbound IPossiblyHarmful message of type {0}",
payload.GetType());
}
else if (payload is ISystemMessage)
{
recipient.SendSystemMessage((ISystemMessage)payload);
}
else
{
recipient.Tell(payload, sender);
}
}
// message is intended for a remote-deployed recipient
else if ((recipient is IRemoteRef || recipient is RepointableActorRef) && !recipient.IsLocal &&
!settings.UntrustedMode)
{
if (settings.LogReceive)
{
var msgLog = string.Format("RemoteMessage: {0} to {1}<+{2} from {3}", payload, recipient, originalReceiver, sender);
log.Debug("received remote-destined message {0}", msgLog);
}
if (provider.Transport.Addresses.Contains(recipientAddress))
{
//if it was originally addressed to us but is in fact remote from our point of view (i.e. remote-deployed)
recipient.Tell(payload, sender);
}
else
{
log.Error(
"Dropping message [{0}] for non-local recipient [{1}] arriving at [{2}] inbound addresses [{3}]",
payloadClass, recipient, recipientAddress, string.Join(",", provider.Transport.Addresses));
}
}
else
{
log.Error(
"Dropping message [{0}] for non-local recipient [{1}] arriving at [{2}] inbound addresses [{3}]",
payloadClass, recipient, recipientAddress, string.Join(",", provider.Transport.Addresses));
}
}