Jim Hoglund wrote: But remember that
objects are synchronized, not methods.
Can you please explain more on the above quote?
Do you mean its the object that has lock, which is required to be acquired by any code that has been declared to be a synchronized block?
To my knowledge you cant attribute object's declaration with 'synchronized' keyword..only code blocks/methods.
But i think it seemed more like common sense to have an inversion of control where the object itself force the code to acquire a lock, there by
what ever code trying to access the object need to acquire lock on that object.
It doesnt seem an impossible idea...and may find good use cases for it.
Am I overlooking any issue here....why java hasnt included this feature???