File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Wating/blocking/sleeping Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Wating/blocking/sleeping" Watch "Wating/blocking/sleeping" New topic
Author

Wating/blocking/sleeping

Angela lewis
Ranch Hand

Joined: Mar 01, 2004
Posts: 100
Is a thread considered to be alive while it is in one of these 3 states.

I thought they shouldn't be because they are not in runnable state. But i read in a book that thread in blocked state is alive.
Why is it so and what about other states?

thanks
Swamy Nathan
Ranch Hand

Joined: May 16, 2004
Posts: 187


The Life Cycle of a Thread

not runnable=Wating/blocking/sleeping

The isAlive method returns true if the thread has been started and not stopped. If the isAlive method returns false, you know that the thread either is a New Thread or is Dead. If the isAlive method returns true, you know that the thread is either Runnable or Not Runnable. You cannot differentiate between a New Thread or a Dead thread. Nor can you differentiate between a Runnable thread and a Not Runnable thread.


Read all about it at

http://java.sun.com/docs/books/tutorial/essential/threads/lifecycle.html
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Wating/blocking/sleeping