From b9884eb209543d36371a794b2c02cf5e18ce03f6 Mon Sep 17 00:00:00 2001 From: Alessandro Boch Date: Mon, 6 May 2013 15:38:06 -0700 Subject: [PATCH] Fix in ForwardingRulesManager async path - Fix in modifyOrAddFlowEntryAsync() path - Protecting concurrent modification to nodeFlows entries through synchronized methods for now Signed-off-by: Alessandro Boch --- .../internal/ForwardingRulesManagerImpl.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/opendaylight/forwardingrulesmanager/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerImpl.java b/opendaylight/forwardingrulesmanager/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerImpl.java index eee08d3a09..4365db3066 100644 --- a/opendaylight/forwardingrulesmanager/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerImpl.java +++ b/opendaylight/forwardingrulesmanager/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerImpl.java @@ -489,7 +489,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, * @return the status of this request. In case of asynchronous call, it * will contain the unique id assigned to this request */ - private Status removeEntry(FlowEntry flowEntry, boolean async) { + private synchronized Status removeEntry(FlowEntry flowEntry, boolean async) { Status error = new Status(null, null); // Sanity Check @@ -667,7 +667,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, /* * Update the node mapped flows database */ - private void updateNodeFlowsDB(FlowEntryInstall flowEntries, boolean add) { + private synchronized void updateNodeFlowsDB(FlowEntryInstall flowEntries, boolean add) { Node node = flowEntries.getNode(); Set flowEntrylist = this.nodeFlows.get(node); @@ -751,7 +751,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, * entry is effectively present in the local database */ @SuppressWarnings("unused") - private Status removeEntry(Node node, String flowName) { + private synchronized Status removeEntry(Node node, String flowName) { FlowEntryInstall target = null; // Find in database @@ -904,7 +904,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, return modifyFlowEntryAsync(currentFlowEntries.getOriginal(), newone); } else { - return installFlowEntry(newone); + return installFlowEntryAsync(newone); } } @@ -923,7 +923,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, * @return null if not found, otherwise the FlowEntryInstall which contains * the existing flow entry */ - private FlowEntryInstall findMatch(FlowEntry flowEntry, boolean looseCheck) { + private synchronized FlowEntryInstall findMatch(FlowEntry flowEntry, boolean looseCheck) { Flow flow = flowEntry.getFlow(); Match match = flow.getMatch(); short priority = flow.getPriority(); @@ -953,7 +953,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, * merged flow may conflict with an existing old container flows merged flow * on the network node */ - private void updateFlowsContainerFlow() { + private synchronized void updateFlowsContainerFlow() { List oldCouples = new ArrayList(); List toReinstall = new ArrayList(); for (Entry> entry : this.nodeFlows @@ -1053,7 +1053,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, } @Override - public void addOutputPort(Node node, String flowName, + public synchronized void addOutputPort(Node node, String flowName, List portList) { Set flowEntryList = this.nodeFlows.get(node); @@ -1083,7 +1083,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, } @Override - public void removeOutputPort(Node node, String flowName, + public synchronized void removeOutputPort(Node node, String flowName, List portList) { Set flowEntryList = this.nodeFlows.get(node); @@ -1118,7 +1118,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, * This function assumes the target flow has only one output port */ @Override - public void replaceOutputPort(Node node, String flowName, + public synchronized void replaceOutputPort(Node node, String flowName, NodeConnector outPort) { FlowEntry currentFlowEntry = null; FlowEntry newFlowEntry = null; @@ -1165,7 +1165,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, } @Override - public NodeConnector getOutputPort(Node node, String flowName) { + public synchronized NodeConnector getOutputPort(Node node, String flowName) { Set flowEntryList = this.nodeFlows.get(node); for (FlowEntryInstall flow : flowEntryList) { @@ -2537,7 +2537,7 @@ public class ForwardingRulesManagerImpl implements IForwardingRulesManager, } @Override - public void flowErrorReported(Node node, long rid, Object err) { + public synchronized void flowErrorReported(Node node, long rid, Object err) { log.trace("Got error {} for message rid {} from node {}", new Object[] {err, rid, node }); /* -- 2.36.6