COM+ Singleton 大量参考文献

发布于 2024-07-07 17:30:32 字数 224 浏览 4 评论 0原文

我有一个 COM+ 数据服务,配置为使用对象池,最小和最大池大小均为 1。所以我有一个单例。 在某些情况下,我的对象计数(引用此实例的客户端数量)超过 1 并稳步增加。 实例创建和对其方法的一次调用包装在 using stmt 中,因此该实例应该正确返回到池中。 与此同时,我看到一些网络问题(SQLServer 的传输级错误异常)。 我怀疑那里可能存在一些相关性。

对象计数如何增加到超过 1?

I have a COM+ data service that is configured to use object pooling with a min and max pool size of 1. So I have a singleton. In some scenarios my Object count (the number of clients that have a reference to this instance) goes beyond 1 and steadily increases.
The instance creation and the one call to its method is wrapped in a using stmt, so that instance should be properly returned to the pool. At the same time this occurs I see some network problems ( transport-level error Exceptions with SQLServer). I suspect that there may be some correlation there.

How is it that Object count increases beyond 1?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

假情假意假温柔 2024-07-14 17:30:32

您正在看到 JIT(即时激活)与对象池的效果。

使用 JIT,多个客户端可以引用同一对象,并且所有方法调用都可以由同一实例提供服务。 每个客户端仅保留对上下文对象的引用。 调用方法后,如果该方法在上下文中设置了 Done 标志,则该对象将与上下文断开连接并放回池中,以供来自另一个客户端的另一个方法调用使用。 这可以节省资源,因为单个对象可以为许多客户端提供服务。

请参阅以下内容:
COM+ 即时激活概念

You are seeing the effects of JIT (just-in-time activation) with object pooling.

With JIT, multiple clients can have references to the same object and all the method calls can be serviced by the same instance. Each client keeps only a reference to a context object. After a method is called, if the method set the Done flag in the context, the object is disconnected from the context and put back in the pool ready to be used by another method call from another client. This saves resources because many clients can be serviced by the single object.

See the following:
COM+ Just-in-Time Activation Concepts

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文