private Object x = new Object();
public void doA() {
synchronized(x){
x = new Object();
//do something
}
}
public void doB() {
synchronized(x) {
//do something
}
}
lets say doA() and doB() was called simultaneously but doA() is proceeding first. so B will be blocked until doA() is completed
is this true even if doA() modifies x in the x = new x call? or after this line x = new x in doA() doB() will no longer be blocked because x has changed?