Jayavardhan geepi wrote:read1.someRead();[/code] from inside 1st synchronized block of above example by Winston.
No, synchronization works from
outside, and you don't have any in the example you showed.
Basically, a synchronized block can only be run by one Thread at a time; however,
what you synchronize on determines whether (or when) the Thread is blocked or not. A synchronized
method always synchronizes on
this, so if you don't want to block all other synchronized methods for the object, you need to find some other way of doing it. The example I gave you above is just one (and it is just an example; I wouldn't expect anyone to code it that way).
Winston