Thread Safety through Self-Loading Collections
page 1 of 7
Published: 19 Sep 2008
Abstract
In this article, David Penton demonstrates how to easily load collections in a thread safe manner. He classifies it as a self-loading collection. He starts by analyzing basic collection usage and then applies the Singleton Pattern to it with the help of relevant C# source code. Penton wraps up the article by giving some tips along with some additional information and the associated source files in downloadable format.
by David Penton
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 31392/ 54

Introduction

If you are a website programmer, you are developing applications that are multi-threaded (whether you know it or not!). This is wonderful and wicked at the same time. Why, do you ask?  Many different users can request the same page with the same options, causing the same code paths to be taken. Suppose you have a collection that needs to be shared across all users within your website. Using the code from the article A New Approach to HttpRuntime.Cache Management, you can certainly store a collection like this in a thread safe manner in HttpRuntime cache. Or, perhaps you can use the Singleton pattern to ensure a single collection. Loading that collection is another matter completely.


View Entire Article

User Comments

No comments posted yet.






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-16 5:51:07 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search