• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Thread pool for mulitple work queues

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 291
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic