跨不同演员类型的可靠演员重入

Reliable actor reentrancy across different actor types

通过阅读 here 我看到演员是可重入的,我希望以下内容是正确的:如果我有单一类型的演员 ThespianType 但三个特定演员 ThespianType (T1, T2, and T3), 则不会死锁:

(external client) -> T1.MethodA() -> T2.MethodB() -> T3.MethodC() -> T1.MethodD()

我的问题是:相同的可重入性是否扩展到多个 actor 类型?

例如,假设我们有:

现在发生这种情况:

(external client) -> P1.MethodX() -> B2.MethodY() -> P1.MethodZ()

假设 MethodZ() 是一个没有阻塞调用的简单方法。

问题:是否会出现死锁(或由于检测到死锁而抛出 ServiceFabric 异常)?

只要您正确使用 Actors(例如,不启动您自己的线程),就不会发生死锁。类型无关紧要。

The Actors runtime allows reentrancy by default. This means that if an actor method of Actor A calls a method on Actor B, which in turn calls another method on Actor A, that method is allowed to run. This is because it is part of the same logical call-chain context. All timer and reminder calls start with the new logical call context. See the Reliable Actors reentrancy for more details.

https://azure.microsoft.com/en-us/documentation/articles/service-fabric-reliable-actors-introduction/