[concurrency-interest] general performance question

Jha, Navin navin.jha at citi.com
Wed Dec 21 10:45:28 EST 2011


Is there an advantage to do:

someMethod(...) {
        synchronized(this) {
                ................
                ................
                ................
        }
}

instead of:
synchronized someMethod(...) {
................
................
................
}

Even when the entire method needs to be synchronized? I understand in general it is a good practice to use synchronized blocks since more often than not only certain lines need to be synchronized.

-Navin



More information about the Concurrency-interest mailing list