• Post Reply Bookmark Topic Watch Topic
  • New Topic

Thread pool for mulitple work queues  RSS feed

 
Diarmuid TelcoEngineer
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would be grateful for any advice on the best solution for the following telecommunications problem;

At run-time, work queues will be created dynamically (in fact 1 per call). In order to ensure that each item in the work queue is fully processed before processing of the next item begins, only 1 thread can act on a work queue at any time.

Possible solutions;

A) Create a new thread per call at runtime. Disadvantage: Inefficient as there is a large thread creation overhead.
B) Create a pool of threads at system startup. When a new work queue is created, remove the thread from the pool and dedicate it to the work queue. When the work queue is destroyed, return the thread to the thread pool. Disadvantage: Requires 1 thread per call, thread will only be busy for brief periods
C) Create a pool of threads at system startup. The pool will monitor a list of work queues but ensure that only 1 thread acts on any work queue at any time.

Does anyone have any other solutions or tips on how to implement solutions B or preferably C?

Thanks in advance.
 
Edward Harned
Ranch Hand
Posts: 291
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the Open Source project Tymeac. It provides a pool of managed threads that may be local or remote (rmi).

Start here: http://coopsoft.com/JavaProduct.html
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!