本文整理汇总了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);
}
示例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);
}
示例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");
}
示例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);
}
示例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);
}