本文整理汇总了C#中ActorSystem.FindActorByPath方法的典型用法代码示例。如果您正苦于以下问题:C# ActorSystem.FindActorByPath方法的具体用法?C# ActorSystem.FindActorByPath怎么用?C# ActorSystem.FindActorByPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActorSystem
的用法示例。
在下文中一共展示了ActorSystem.FindActorByPath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AsyncStopActor
public void AsyncStopActor()
{
var actf = new ActorSystem();
var act1 = actf.CreateActor<AsyncTestActor>("parent");
var act2 = act1.Ask<ActorRef>(new createchildactormsg()).Result;
Assert.IsNotNull(actf.FindActorByPath("\\user\\parent\\child"));
bool f = false;
act1.Tell(new stopchildex() { child = act2,
childstopped = () => { f = true; } });
while (!f)
{
Thread.SpinWait(0);
}
Assert.IsNull(actf.FindActorByPath("\\user\\parent\\child"));
}
示例2: FindActorByPath
public void FindActorByPath()
{
var actf = new ActorSystem();
var act = actf.CreateActor<IerarhyTestActor>("myactor");
var act2 = act.Ask<ActorRef>(new createchildactormsg()).Result;
var fact = actf.FindActorByPath("\\user\\myactor\\child");
Assert.NotNull(fact);
Assert.AreEqual(act2, fact);
}
示例3: SystemStopTest
public void SystemStopTest()
{
var actf = new ActorSystem();
var act1 = actf.CreateActor<ChildStopRestartActor>("parent");
var act2 = act1.Ask<ActorRef>(new createchildactormsg()).Result;
var act3 = actf.FindActorByPath("\\user\\parent\\child");
Assert.AreEqual(act3, act2);
actf.StopSystem();
act3 = actf.FindActorByPath("\\user\\parent\\child");
Assert.IsNull(act3);
}