本文整理匯總了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);
}