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


C# IInternalActorRef.Equals方法代码示例

本文整理汇总了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));
     }
 }
开发者ID:Micha-kun,项目名称:akka.net,代码行数:7,代码来源:ActorCell.DeathWatch.cs

示例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));
            }
        }
开发者ID:rogeralsing,项目名称:akka.net,代码行数:96,代码来源:Endpoint.cs


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