Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Thread Pooling and its implementation

 
Yatish Sonkeshariya
Greenhorn
Posts: 16
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am new in Java-Thread. Can you explain what is Thread-Pooling and how we can implement this concept in java?

 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic