File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Thread State Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Thread State" Watch "Thread State" New topic

Thread State

Ahmed Basheer
Ranch Hand

Joined: Apr 15, 2004
Posts: 77
If there is the blocking socket read call in a thread, what would be the state of the thread? I would assume the state of the thread to be blocked but it is not. The state of the thread to my surprise is RUNNABLE.

e.g The state of the folloeing thead is RUNNABLE even though the socket is
blocked on read call.Any Observations?

new Thread ()
public void run()

William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
I suspect the aswwer is that since the Thread is blocked while executing native code, as far as Java is concerned it is still Runnable. I see that in Java 1.5 we have a java.lang.Thread.State Enum - see the JavaDocs for the exact meaning of the various states.
I agree. Here's the link:
subject: Thread State
It's not a secret anymore!