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 Pooling and its implementation 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 Pooling and its implementation" Watch "Thread Pooling and its implementation" New topic

Thread Pooling and its implementation

Yatish Sonkeshariya

Joined: Sep 28, 2011
Posts: 16

Hi All,
I am new in Java-Thread. Can you explain what is Thread-Pooling and how we can implement this concept in java?

Thanks, Yatish Sonkeshariya
Pune(411001), India
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2904

Thread pool contains pre-instantiated worker threads which will execute job/task you pass to it. Thread pool minimizes the overhead of creating and destroying the threads.

Example like, web server, which takes and executes thread from thread pool for each request received.

In order to see how one can implement it, I suggest to go through JDK code for java.util.concurrent.ThreadPoolExecutor

[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
I agree. Here's the link:
subject: Thread Pooling and its implementation
jQuery in Action, 3rd edition