ER-094 Use 'wait ()' and 'notifyAll ()' instead of polling loops

Severity2
Enabledyes
Waivable
Violation
public void run() {
	try {
		while (true) {
			if (!working) {
				sleep(TIMEOUT);
			}
		}
	} catch (InterruptedException e) {
		logger.debug(STOP_TXT);
	}
}
Fix
public void run() {
	try {
		while (working) {
			wait(TIMEOUT);
		}
	} catch (InterruptedException e) {
		logger.debug(STOP_TXT);
	}
}


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