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 Threads and Synchronization and the fly likes Synchronized static methods and plain synchronized methods Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "Synchronized static methods and plain synchronized methods" Watch "Synchronized static methods and plain synchronized methods" New topic
Author

Synchronized static methods and plain synchronized methods

Kunaal A Trehan
Ranch Hand

Joined: Feb 04, 2004
Posts: 63
Hi
Consider a case where I have 2 methods,1 is synchronized and other is static synchronized.

Both these methods are called from the run mthd().

Lets suppose one thread is calling static synchronized method.Its still under process.

Can another thread call the other non static synchronized method

Rgds Kunal
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
Synchronized static methods lock the single Class instance while instance (non-static) methods lock the instance of the class on which they are executed. Thus, neither will block the other.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Synchronized static methods and plain synchronized methods
 
Similar Threads
Thread class
Static and Non static Synchronized methods
thread's
Synchronization
keyword synchronized