This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Can a dead thread be restarted? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Can a dead thread be restarted?" Watch "Can a dead thread be restarted?" New topic
Author

Can a dead thread be restarted?

Tej Ernesto
Greenhorn

Joined: Jun 17, 2012
Posts: 5
can a dead thread be restarted?? if so how can it be
Pramod P Deore
Ranch Hand

Joined: Jul 15, 2008
Posts: 629

You can't restart a thread

Life is easy because we write the source code.....
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

here, think thread like a person
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 12953
    
    3

The API documentation of Thread.start() says:

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


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Rahul M Mishra
Greenhorn

Joined: Jul 02, 2012
Posts: 10
NO!
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19232

If you need to restart a Thread, put all the logic in a Runnable and start a new Thread with the same Runnable instead.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
 
jQuery in Action, 2nd edition
 
subject: Can a dead thread be restarted?
 
Similar Threads
Garbage collection Q
Restarting Thread
regarding start()
Question on Thread
Threads Question.