473,396 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Multiple Request Processor

Hi All,
I have the following requirement.

I have table which contains requestID, priority and the request
status(status can be 'Queued','Procesing','Completed','Failed')

I need a class which takes 5 top priority requests and process the
same simultaniously, now if any of these requests completed, for the
same slot I should get the next priority requests to process.

How do I do this? I thought og doing using ThreadPool, but in
threadPool we dont have the facility to know whether the given thread
is completed or not :(

Please help me in this regard.

Thank you.

Aug 6 '07 #1
2 1830
Karthik D V wrote:
Hi All,
I have the following requirement.

I have table which contains requestID, priority and the request
status(status can be 'Queued','Procesing','Completed','Failed')

I need a class which takes 5 top priority requests and process the
same simultaniously, now if any of these requests completed, for the
same slot I should get the next priority requests to process.

How do I do this? I thought og doing using ThreadPool, but in
threadPool we dont have the facility to know whether the given thread
is completed or not :(

Please help me in this regard.

Thank you.
Use an array of Thread objects, and monitor the ThreadState property of
them.

--
Göran Andersson
_____
http://www.guffa.com
Aug 6 '07 #2
Karthik D V wrote:
Hi All,
I have the following requirement.

I have table which contains requestID, priority and the request
status(status can be 'Queued','Procesing','Completed','Failed')

I need a class which takes 5 top priority requests and process the
same simultaniously, now if any of these requests completed, for the
same slot I should get the next priority requests to process.

How do I do this? I thought og doing using ThreadPool, but in
threadPool we dont have the facility to know whether the given thread
is completed or not :(

Please help me in this regard.
It seems to me that a simple approach would be to use the
BackgroundWorker class, handle the RunWorkerCompleted event, and in your
handler, start a new BackgroundWorker from your queue of prioritized
requests.

You would initialize the whole thing by starting five BackgroundWorkers
initially, and then only starting a new BackgroundWorker after that in
your RunWorkerCompleted event handler.

If you have the ability to add new requests after processing has
started, then you would want to keep a counter of the active requests
(add one when you start a BackgroundWorker, subtract one in the
RunWorkerCompleted event handler), and allow for a new requests to be
started as it's added if you are under your maximum of five.

Pete
Aug 6 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: jason | last post by:
How does one loop through the contents of a form complicated by dynamic construction of checkboxes which are assigned a 'model' and 'listingID' to the NAME field on the fly in this syntax:...
5
by: CM | last post by:
Hi, there: I have some questions, I hope someone can briefly describe how ASP (not ASP.Net) to do the following things: 1) Get real-time information from other web site such as tracking via...
2
by: Colin Steadman | last post by:
Part No Description Quantity 45643 Random part 10 45678 Another Random part 7 98944 And another 1 <submit button> ...
4
by: steve | last post by:
I'm new to XML, so pardon the stupid question. I've looked thru several books with not luck. All I want to do is associate one xml file with multiple xsl stylesheets. For example, if the user...
4
by: Mark Duregon | last post by:
Hi, I am trying to create a Windows Service in C# that will install on a single box to support multiple environments. I have created the service and it works perfect. Now however, the client has...
7
by: rdh | last post by:
Hi all, I am in process of developing a Server in C++ supporting multiple protocols. The server will be exposing various functionalities, and the clients can communicate over any of the...
11
by: Mike | last post by:
Looking to find any information on how to properly configure multiple instances of DB2. This is on Win2k db2 ver 7.2. I am basically looking for information on how the multiple instance settings...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
4
by: seets375 | last post by:
Hi, I have two ethernet interfaces on my system, with IPs assigned to the interfaces from different subnets (e.g. eth1 - 10.10.10.10 and eth2 - 20.20.20.20 ). I'm connecting these interfaces to...
35
by: keerthyragavendran | last post by:
hi i'm downloading a single file using multiple threads... how can i specify a particular range of bytes alone from a single large file... for example say if i need only bytes ranging from...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.