File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Threads and Synchronization and the fly likes Thread pool Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Thread pool" Watch "Thread pool" New topic

Thread pool

Mike Nightsky
Ranch Hand

Joined: Aug 18, 2001
Posts: 48
Has anybody experience with Threadpools or a good example of an working one?
Thanks in advance.

Win the opportunity to make money on the Internet<br /><a href="" target="_blank" rel="nofollow"></a>
Alex Zhang
Ranch Hand

Joined: Apr 19, 2001
Posts: 68
I have implemented thread pool twice in two project. Do U mean U want to have coding sample?
My implementation is that once the pool is instantiated, it will itself create a cluster of threads which are available for assigning.
Threads will be assigned to the requesters in an ordered manner which can be replaced with any mechanism, some may like round robbin. here I just use it as a reference.
If the number of available threads reaches 0, I will increase the pool size by adding additional threads to it.
If U want to have detail implementation, please reply and let me send U the code.
John Harby

Joined: Jan 04, 2002
Posts: 20
Doug Lea has an excellent implementation in his (open source) package -
I agree. Here's the link:
subject: Thread pool
It's not a secret anymore!