gpt4 book ai didi

azure - 跨不同 Actor 类型的可靠 Actor 重入

转载 作者:行者123 更新时间:2023-12-03 03:09:45 27 4
gpt4 key购买 nike

来自阅读here我发现 Actor 是可重入的,并且我希望以下情况成立:如果我有单一类型的转换 ThespianType 但有三个特定的 Actor ThespianType (T1T2T3),那么这不会死锁:

(外部客户端)-> T1.MethodA() -> T2.MethodB() -> T3.MethodC() -> T1.MethodD()

我的问题是:相同的重入性是否扩展到多种参与者类型?

例如,假设我们有:

  • 两种 Actor 类型 PainterTypeBrushType;和
  • 每种类型一名 Actor :画家P1和画笔B2

现在发生这种情况:

(外部客户端)-> P1.MethodX() -> B2.MethodY() -> P1.MethodZ()

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

问题:这个会死锁(或者由于检测到死锁而引发 ServiceFabric 异常)吗?

最佳答案

只要正确使用 Actor(例如不启动自己的线程),就不会发生死锁。类型并不重要。

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/

关于azure - 跨不同 Actor 类型的可靠 Actor 重入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40292355/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com