Interop.Domino dll线程安全吗? [英] Is Interop.Domino dll thread safe?

查看:112
本文介绍了Interop.Domino dll线程安全吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在c#应用程序中使用Interop.Domino dll版本1.2,并通过为每个创建的线程创建新会话(一次最多5个线程)来使用多线程同时访问多个NSF文件.

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).

对于较大的NSF文件,我收到Notes错误,例如内存段溢出. 为了克服这个问题,我使用Marshal.ReleaseComObject(object)释放了必要的Notesdocument和NotesView对象.

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.

现在,问题就像,我能够访问2个NSF文件,但是其余线程正在dll异常中运行,因为很少有Notes对象变为null.

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....

感谢帮助.

推荐答案

最近我一直在对这个相同的问题进行一些实验.

I have been doing some experiments on this very same question recently.

我编写了一个测试程序,该程序可以启动两种不同类型的线程.每个线程配置为可与8到10个用户一起使用.每个线程的确必须读取Domino目录才能为用户找到邮件文件,并且每个线程还将结果文档写入单个公共NSF文件.但是对于邮件文件中的主要工作,没有两个线程可以访问同一NSF. NSF文件分布在两台服务器上.五个线程正在使用NotesDatabase.Search,五个线程正在读取NotesView并向下钻取NotesViewEntry对象.我遇到了与您遇到的内存问题相同的问题,并以相同的方式解决了它-但我非常小心,不要为Domino目录或输出NSF发布数据库对象.我已经运行了多达10个活动线程的测试代码,没有问题.

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.

这令人鼓舞,但是我认为这还不足以证明Domino COM对象是完全线程安全的.

This is encouraging, however I do not think this is really enough proof that the Domino COM objects are completely thread safe.

这篇关于Interop.Domino dll线程安全吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆