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


C# ActorRef.AsInstanceOf方法代码示例

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


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

示例1: Send

 public override void Send(object message, ActorRef sender)
 {
     if (sender is LocalActorRef)
     {
         sender.AsInstanceOf<LocalActorRef>().Provider.DeadLetters.Tell(message);
     }
 }
开发者ID:Badmoonz,项目名称:akka.net,代码行数:7,代码来源:Router.cs

示例2: SerializedActorPath

        public static string SerializedActorPath(ActorRef @ref)
        {
            /*
val path = actorRef.path
    val originalSystem: ExtendedActorSystem = actorRef match {
      case a: ActorRefWithCell ⇒ a.underlying.system.asInstanceOf[ExtendedActorSystem]
      case _                   ⇒ null
    }
    Serialization.currentTransportInformation.value match {
      case null ⇒ originalSystem match {
        case null ⇒ path.toSerializationFormat
        case system ⇒
          try path.toSerializationFormatWithAddress(system.provider.getDefaultAddress)
          catch { case NonFatal(_) ⇒ path.toSerializationFormat }
      }
      case Information(address, system) ⇒
        if (originalSystem == null || originalSystem == system)
          path.toSerializationFormatWithAddress(address)
        else {
          val provider = originalSystem.provider
          path.toSerializationFormatWithAddress(provider.getExternalAddressFor(address).getOrElse(provider.getDefaultAddress))
        }
    }*/
            ActorSystem originalSystem = null;
            if (@ref is ActorRefWithCell)
            {
                originalSystem = @ref.AsInstanceOf<ActorRefWithCell>().Underlying.System;
                if (CurrentTransportInformation == null)
                {
                    return @ref.Path.ToSerializationFormat();
                }
                return @ref.Path.ToStringWithAddress(CurrentTransportInformation.Address);
            }
            return @ref.Path.ToSerializationFormat();
        }
开发者ID:ClusterReply,项目名称:akka.net,代码行数:35,代码来源:Serialization.cs

示例3: RestartChild

 /// <summary>
 ///     Restarts the child.
 /// </summary>
 /// <param name="child">The child.</param>
 /// <param name="cause">The cause.</param>
 /// <param name="suspendFirst">if set to <c>true</c> [suspend first].</param>
 private void RestartChild(ActorRef child, Exception cause, bool suspendFirst)
 {
     var c = child.AsInstanceOf<InternalActorRef>();
     if (suspendFirst)
         c.Suspend();
     c.AsInstanceOf<InternalActorRef>().Restart(cause);
 }
开发者ID:pdoh00,项目名称:akka.net,代码行数:13,代码来源:SupervisorStrategy.cs

示例4: ResumeChild

 /// <summary>
 ///     Resumes the child.
 /// </summary>
 /// <param name="child">The child.</param>
 /// <param name="exception">The exception.</param>
 private void ResumeChild(ActorRef child, Exception exception)
 {
     child.AsInstanceOf<InternalActorRef>().Resume(exception);
 }
开发者ID:pdoh00,项目名称:akka.net,代码行数:9,代码来源:SupervisorStrategy.cs

示例5: ProcessFailure

        /// <summary>
        ///     Processes the failure.
        /// </summary>
        /// <param name="actorCell">The actor cell.</param>
        /// <param name="restart">if set to <c>true</c> [restart].</param>
        /// <param name="child">The child.</param>
        /// <param name="cause">The cause.</param>
        private void ProcessFailure(ActorCell actorCell, bool restart, ActorRef child, Exception cause)
        {
            if (restart)
            {
                RestartChild(child, cause, false);
            }
            else
            {
                child.AsInstanceOf<InternalActorRef>().Stop();
            }
            /*
    if (children.nonEmpty) {
      if (restart && children.forall(_.requestRestartPermission(retriesWindow)))
        children foreach (crs ⇒ restartChild(crs.child, cause, suspendFirst = (crs.child != child)))
      else
        for (c ← children) context.stop(c.child)
    }
             */

            //if (children.Any())
            //{
            //    if (restart)
            //    {

            //    }
            //    else
            //    {
            //        foreach (var child in children)
            //        {
            //            child.Stop();
            //        }
            //    }
            //}
        }
开发者ID:pdoh00,项目名称:akka.net,代码行数:41,代码来源:SupervisorStrategy.cs

示例6: ProcessFailure

 protected override void ProcessFailure(ActorCell actorCell, bool restart, ActorRef child, Exception cause)
 {
     if (restart)
     {
         foreach (var c in actorCell.GetChildren().ToArray())
         {
             RestartChild(child, cause, false);
         }
     }
     else
     {
         foreach (var c in actorCell.GetChildren().ToArray())
         {
             child.AsInstanceOf<InternalActorRef>().Stop();
         }
     }
 }
开发者ID:ClusterReply,项目名称:akka.net,代码行数:17,代码来源:SupervisorStrategy.cs


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