1
我在編寫管理CompletionStages的工具,需要使用Akka安排CompletionStage。有沒有辦法讓Akka成爲CompletionStage,並讓它稍後運行它?在Akka安排完成階段
我通常使用的演員是這樣的:
class MyActor extends UntypedActor {
public void onReceive(Object msg) throws Exception {
doTheWork();
}
}
final ActorRef ref = system.actorOf(Props.create(MyActor.class, this));
system.scheduler().schedule(Duration.Zero(), ref, "Test", system.dispatcher(), null);
有沒有辦法讓阿卡一個CompletionStage到沒有演員像這樣明確地完成了階段運行:
class MyActor extends UntypedActor {
public void onReceive(Object msg) throws Exception {
myStage.toCompletableFuture().get();
}
}