Interop.Domino dll 线程安全吗?
我在 c# 应用程序中使用 Interop.Domino dll 版本 1.2,并使用多线程通过为创建的每个线程创建新会话(一次最多 5 个线程)来同时访问多个 NSF 文件。
对于大型 NSF 文件,我收到了 Notes 错误,例如内存段溢出。 为了克服这个问题,我使用 Marshal.ReleaseComObject(object) 来尽可能释放必要的 Notesdocument 和 NotesView 对象。
现在,问题是,我能够访问 2 个 NSF 文件,但其余线程将陷入 dll 异常,因为少数 Notes 对象变为空。
请为我提供一些帮助......
感谢您的帮助。
I am using Interop.Domino dll version 1.2 in c# application, and using multithreading to access multiple NSF file at same time by creating new session for each thread created (Max 5 threads at a time).
For the large NSF files, I was getting the Notes error like memory segment overflow.
To overcome this problem, i used Marshal.ReleaseComObject(object) to release the necessary Notesdocument, and NotesView object where ever possible.
Now, the issues is like, i am able to access 2 NSF files but the rest threads are going in dll exceptions as few Notes object are getting null.
Kindly provide me some help....
Thanks for help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最近一直在对这个同样的问题进行一些实验。
我编写了一个测试程序来启动两种不同类型的线程。每个线程配置为与 8 到 10 个用户一起工作。每个线程都必须读取 Domino 目录才能找到用户的邮件文件,并且每个线程还将结果文档写入单个公共 NSF 文件。但对于邮件文件中的主要工作,没有两个线程访问同一个 NSF。 NSF 文件分布在两台服务器上。其中五个线程正在使用 NotesDatabase.Search,其中五个线程正在读取 NotesView 并向下钻取 NotesViewEntry 对象。我遇到了与您遇到的相同的内存问题,并以相同的方式解决了它 - 但我非常小心,没有释放 Domino 目录或输出 NSF 的数据库对象。我已使用最多 10 个活动线程运行此测试代码,没有出现任何问题。
这是令人鼓舞的,但是我认为这并不足以证明 Domino COM 对象是完全线程安全的。
I have been doing some experiments on this very same question recently.
I have written a test program that launches two different types of threads. Each thread is configured to work with 8 to 10 users. Every thread does have to read the Domino Directory in order to locate the mail file for the users, and each thread also writes results documents to a single common NSF file. But for the main work in the mail files, no two threads are ever accessing the same NSF. The NSF files are spread across two servers. Five of the threads are using NotesDatabase.Search, and five of the threads are reading a NotesView and drilling down to the NotesViewEntry objects. I ran into the same memory issue that you encountered, and solved it the same way -- but I was very careful not to release the Database objects for the Domino Directory or the output NSF. I've run this test code with up to 10 active threads, with no problems.
This is encouraging, however I do not think this is really enough proof that the Domino COM objects are completely thread safe.