Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / December 2005

Tip: Looking for answers? Try searching our database.

QueueUserWorkItem: Design guidance

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
test.file@gmail.com - 12 Dec 2005 19:39 GMT
I'd like to implement QueueUserWorkItem for some parts of the app;
specifically for DB related caching and file i/o. Example: When the
user finishes work on a file, I'd like to process the file persistence
(some data to db + file system as zip) in the background.  I haven't
worked with ThreadPool before so am asking for ideas/guidance for
implementation.

On the client side (WinForm), I'm likely to be remoting for some db
cache load/lookup.  I have a DB "Service" singleton class which
centralizes DB layer access for the client and a singleton "Cache"
class for storing various other details. The FileSystem related class
is not a singleton, but can be converted to it.  Some of the methods in
all 3 classes are candidates, in my opinion, for ThreadPool (like
save/read/zip/unzip a file, load all cache from DB/IIS). The app will
be running in Terminal Services against a network file share.

Do you think using the ThreadPool in this scenario a good idea?  I'm
currently looking at ThreadPoolThrottle
(http://msdn.microsoft.com/msdnmag/issues/04/12/NETMatters/) and
thinking what would be a clean way to implement QueueUserWorkItem such
that I can identify which methods in the singleton should block for a
job to finish while other methods can let the request pass through?

Thanks for any ideas.
Roland - 12 Dec 2005 20:20 GMT
Hi

I personally would suggest to start for each operation a new thread and
to get your methods which are working on the DB and the file system
Thread-Safe.
I don't see any need for a thread pool.

But perhaps I didn't understand your need correctly - just a suggestion.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.