How to re-use a thread in Java ?
Posted
by David
on Stack Overflow
See other posts from Stack Overflow
or by David
Published on 2010-06-06T17:10:58Z
Indexed on
2010/06/06
17:22 UTC
Read the original article
Hit count: 404
I am a building a console Sudoku Solver where the main objective is raw speed.
I now have a ManagerThread that starts WorkerThreads to compute the neibhbors of each cell. So one WorkerThread is started for each cell right now. How can I re-use an existing thread that has completed its work?
The Thread Pool Pattern seems to be the solution, but I don't understand what to do to prevent the thread from dying once its job has been completed.
ps : I do not expect to gain much performance for this particular task, just want to experiment how multi-threading works before applying it to the more complex parts of the code.
Thanks
© Stack Overflow or respective owner