This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
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

Win a copy of Elasticsearch in Action this week in the Big Data forum!
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: 2902

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]
rocket mass heater kickstarter
subject: Thread Pooling and its implementation