Java Thread wait() => blocked?

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2010-03-28T19:12:07Z Indexed on 2010/03/28 19:13 UTC
Read the original article Hit count: 117

Filed under:
|

According to http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Thread.State.html calling wait() will result a thread to go in BLOCKED state. However this piece of code will result (after being called) in a Thread in WAITING State.

class bThread extends Thread {
    public synchronized void run() {
        try {
            wait();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

}

Have I got something wrong? Can anybody explain this behaviour to me? Any help would be appreciated!

© Stack Overflow or respective owner

Related posts about java

Related posts about concurrent