* @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
/*
* 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<FlowEntryInstall> flowEntrylist = this.nodeFlows.get(node);
* 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
return modifyFlowEntryAsync(currentFlowEntries.getOriginal(),
newone);
} else {
- return installFlowEntry(newone);
+ return installFlowEntryAsync(newone);
}
}
* @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();
* merged flow may conflict with an existing old container flows merged flow
* on the network node
*/
- private void updateFlowsContainerFlow() {
+ private synchronized void updateFlowsContainerFlow() {
List<FlowEntryInstall> oldCouples = new ArrayList<FlowEntryInstall>();
List<FlowEntry> toReinstall = new ArrayList<FlowEntry>();
for (Entry<Node, Set<FlowEntryInstall>> entry : this.nodeFlows
@Override
public List<FlowEntry> getFlowEntriesForGroup(String policyName) {
- List<FlowEntry> list = null;
+ List<FlowEntry> list = new ArrayList<FlowEntry>();
if (this.groupFlows != null && this.groupFlows.containsKey(policyName)) {
- list = new ArrayList<FlowEntry>();
for (FlowEntryInstall entries : groupFlows.get(policyName)) {
list.add(entries.getOriginal());
}
- return new ArrayList<FlowEntry>();
}
return list;
}
@Override
- public void addOutputPort(Node node, String flowName,
+ public synchronized void addOutputPort(Node node, String flowName,
List<NodeConnector> portList) {
Set<FlowEntryInstall> flowEntryList = this.nodeFlows.get(node);
}
@Override
- public void removeOutputPort(Node node, String flowName,
+ public synchronized void removeOutputPort(Node node, String flowName,
List<NodeConnector> portList) {
Set<FlowEntryInstall> flowEntryList = this.nodeFlows.get(node);
* 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;
}
@Override
- public NodeConnector getOutputPort(Node node, String flowName) {
+ public synchronized NodeConnector getOutputPort(Node node, String flowName) {
Set<FlowEntryInstall> flowEntryList = this.nodeFlows.get(node);
for (FlowEntryInstall flow : flowEntryList) {
}
@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 });
/*