Hi,
>For static methods the lock comes _not_ from the instance of MyObject, but >from the MyObject Class that was loaded into memory when the program >started.
say I have something like this;
class MyObject
{
public static synchronized void ASynchronizedMethod()
{
}
public static synchronized void anotherSynchronizedStaticMethod()
{
}
}
are you saying that a call to ASynchronizedMethod causes a lock to be acquired from the class (not instance... as it's static). If thats the case then is it the case that a call to anotherSynchronizedStaticMethod at the same time will block until the lock from the first ASynchronizedMethod call (acquired from class not instance) has completed.
I guess what I'm trying to fathom is this. For static methods, locks are acquired from the class and thus only one static synchronized method can be invoked at any one time as locks are acquired from the class and not instance.
Is that incorrect? Sorry if it's gibberish!
thanks
Graham