This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Threads and Synchronization and the fly likes Pool of threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Pool of threads" Watch "Pool of threads" New topic

Pool of threads

Isaac Ferguson
Ranch Hand

Joined: Jun 22, 2012
Posts: 563

sorry for the "basic" question

I am in a real hurry. I have been asked to create a "queue the dao operations to a pool of 10 threads. Those background threads will actually store the user details in the database."

I have not use this approach before. I know I shouldn`t ask for code here. But could somebody post a piece of code for this functionality and explain it please



Jayesh A Lalwani
Saloon Keeper

Joined: Jan 17, 2008
Posts: 2667

look at java.util.concurrent.Executor. It contains what you need to run a queue of tasks in a thread pool
I agree. Here's the link:
subject: Pool of threads
It's not a secret anymore!