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


C# ActorSystem.StopActor方法代码示例

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


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

示例1: PostStopErrTest

        public void PostStopErrTest()
        {
            Exception e = null;
            var acts = new ActorSystem();
            var act = acts.CreateActor<RestartFaultActor>();
            try
            {
                acts.StopActor(act);
            }
            catch (Exception ex) { e = ex; }

            Assert.IsNull(e);
        }
开发者ID:lebaon,项目名称:AEF,代码行数:13,代码来源:InActorTests.cs

示例2: ChildHasStopedOrRestartedOnlyByParent

        public void ChildHasStopedOrRestartedOnlyByParent()
        {
            var actf = new ActorSystem();
            var act1 = actf.CreateActor<IerarhyTestActorOvveride>();

            var tsk = act1.Ask<ActorRef>(new createchildactormsg());
            tsk.Wait();

            var act2 = tsk.Result;
            Assert.IsNotNull(act2);

            bool f = false;

            try
            {

                actf.StopActor(act2);
            }
            catch
            {
                f = true;
            }

            Assert.IsTrue(f);
            f = false;

            try
            {

                actf.RestartActor(act2);
            }
            catch
            {
                f = true;
            }

            Assert.IsTrue(f);
        }
开发者ID:lebaon,项目名称:AEF,代码行数:38,代码来源:ActorIerarhyTests.cs

示例3: SimpleTestStopActor

        public void SimpleTestStopActor()
        {
            bool f = false;

            var acts = new ActorSystem();
            var act = acts.CreateActor<SimpleTestActor>();
            acts.StopActor(act);
            var m = new acttestmsg()
            {
                act = () =>
                {
                    f = true;
                    return 0;
                },
                msg = "test message"
            };

            var tsk = act.Ask<int>(m);
            try
            {
                tsk.Wait();
            }
            catch (AggregateException e) { }

            Assert.IsFalse(f);
            Assert.IsNotNull(tsk.Exception);
            Console.WriteLine("test complete");
        }
开发者ID:lebaon,项目名称:AEF,代码行数:28,代码来源:BasicTests.cs

示例4: PostStopTest

        public void PostStopTest()
        {
            bool f = false;
            var acts = new ActorSystem();
            var act = acts.CreateActor<IntoTestActor>();

            var m = new poststoptestmsg() { poststop = () => { f = true; } };
            var tsk = act.Ask<int>(m);
            tsk.Wait();
            Assert.IsFalse(f);
            acts.StopActor(act);

            Assert.IsTrue(f);
        }
开发者ID:lebaon,项目名称:AEF,代码行数:14,代码来源:InActorTests.cs

示例5: StopParentStoppingChilds

        public void StopParentStoppingChilds()
        {
            var actf = new ActorSystem();
            var act1 = actf.CreateActor<IerarhyTestActor>();

            var tsk = act1.Ask<ActorRef>(new createchildactormsg());
            tsk.Wait();

            var act2 = tsk.Result;
            Assert.IsNotNull(act2);

            actf.StopActor(act1);

            bool f = false;
            try
            {
                act1.Ask<int>(new acttestmsg()
                {
                    act = () => { return 0; }
                })
                    .Wait(100);
            }
            catch
            {
                f = true;
            }

            Assert.IsTrue(f);
            f = false;
            try
            {
                act2.Ask<int>(new acttestmsg()
                {
                    act = () => { return 0; }
                })
                    .Wait(100);
            }
            catch
            {
                f = true;
            }

            Assert.IsTrue(f);
        }
开发者ID:lebaon,项目名称:AEF,代码行数:44,代码来源:ActorIerarhyTests.cs


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