aspose file tools*
The moose likes Beginning Java and the fly likes Calling methods on a waiting thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Calling methods on a waiting thread" Watch "Calling methods on a waiting thread" New topic
Author

Calling methods on a waiting thread

Roy Mallard
Ranch Hand

Joined: Jul 14, 2005
Posts: 53
IF a thread is waiting on an object, and some other threads call the thread's methods, do the method calls get queued up and invoked when the thread is notified?


SCJP 1.4<br />SCJD
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Hi Roy,

Threads don't have methods; they invoke methods. A method always runs on the Thread that calls it -- although sometimes, the calling thread has to wait for the privilege.

If a Thread is waiting on an object, that actually has no effect at all on any other threads that call any of that same object's methods.


[Jess in Action][AskingGoodQuestions]
 
 
subject: Calling methods on a waiting thread