How Java synchronization behaves if a method parameter is used in the synchronization block instead of this keyword.
public void doSomething(final MyInterface iface) {
synchronized(this) {
// ... do some work
}
}
vs
public void doSomething(final MyInterface iface) {
synchronized(iface) {
// ... do some work
}
}
Will the net effect be the same?