开发者

How to create a self monitoring threading pattern in .NET

I have a table in a Database of a list of items that need to be checked (imap mailboxes) . The list is dynamic and can change at any time with users been added or deleted. I have created a windows service (in .Net) that reads the table to 开发者_如何学JAVAget all the mailboxes to be checked and processes any new mail that is found.

My first attempt was to populate a queue with the items to process and then recheck the table every few minutes for changes clearing the queue and re-adding items back to it. I used a finite number of threads which dequeue and then enqueue items from the list once processing is complete.

Issues I found was a slow memory leak which I was only able to resolve by poulating the queue once (on startup of the service) and therefore having to restart the service if and changes to my database table happened. second issue is being unable to figure out how to monitor if my finite list of threads were still running.

Any thoughts?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜