How can a dead thread be restarted? [duplicate]

Solution 1:

Thread lifecycle image

If you look at the Thread Life Cycle Image, there is no way you can go back to new position once your thread has terminated.

So there is no way to bring back the dead thread to runnable state,instead you should create a new Thread instance.

Solution 2:

From the JavaDocs...

It is never legal to start a thread more than once. In particular, a thread may not be restarted once it has completed execution.

You'll have to start a brand new instance.

Preferably, the actions you want to execute should be wrapped up in a Runnable interface, that way you can simply pass the Runnable to a new instance of Thread