ER-008 Synchronize at the block level rather than the method level

Severity2
Enabledyes
Waivable
Violation
public synchronized void updateState(final int newVal) {
	objState += newVal;
}
Fix
public void updateState(final int newVal) {
	synchronized (this) {
		objState += newVal;
	}
}


Hammurapi 3 Copyright © 2004 Hammurapi Group. All Rights Reserved.