Sho SHIMIZU

Make FlowOperationsProcessor thread-safe with synchronized modifier

Different threads could call run(), satisfy() and fail() method.
Each of the methods reads/writes multiple fields during the method call.
These method calls need to be synchronized to gurantee to see the
latest value.

Change-Id: Ic252b56e0902170d7e0fdb83f96f0fb2e55ec56b
......@@ -587,7 +587,7 @@ public class FlowRuleManager
}
@Override
public void run() {
public synchronized void run() {
if (stages.size() > 0) {
process(stages.remove(0));
} else if (!hasFailed.get() && context != null) {
......@@ -632,7 +632,7 @@ public class FlowRuleManager
}
}
void satisfy(DeviceId devId) {
synchronized void satisfy(DeviceId devId) {
pendingDevices.remove(devId);
if (pendingDevices.isEmpty()) {
operationsService.execute(this);
......@@ -641,7 +641,7 @@ public class FlowRuleManager
void fail(DeviceId devId, Set<? extends FlowRule> failures) {
synchronized void fail(DeviceId devId, Set<? extends FlowRule> failures) {
hasFailed.set(true);
pendingDevices.remove(devId);
if (pendingDevices.isEmpty()) {
......