dcsimg
Synchronized static methods and plain synchronized methods
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Kunal_Verma
Posted On:   Sunday, January 9, 2005 11:23 PM

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

Re: Synchronized static methods and plain synchronized methods

Posted By:   Jani_Kaarela  
Posted On:   Tuesday, January 11, 2005 08:35 AM


Short answer: yes.



A synchronized method acquires the associated lock before entering the method body. In the case of an instance method, the lock is the object itself. In the case of a static method, the class acts as the lock. See chapter 17.13 in the Java Language Specification.

About | Sitemap | Contact