the synchronized was inside the if before, that's why. Rule is you need to if twice if you synchronized based on that condition ;) You switched the 2 lines, so it doesn't make sense anymore.