Add missing conn.endTx(Transaction.COMMIT) statements.
diff --git a/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java b/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java
index 3f74ff1..1a9b70a 100644
--- a/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java
+++ b/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java
@@ -371,8 +371,10 @@
log.error(":addFlow FlowId:{} failed",
flowPath.flowId().toString());
}
- if (flowObj == null)
+ if (flowObj == null) {
+ conn.endTx(Transaction.COMMIT);
return false;
+ }
//
// Set the Flow key:
@@ -420,8 +422,10 @@
log.error(":addFlow FlowEntryId:{} failed",
flowEntry.flowEntryId().toString());
}
- if (flowEntryObj == null)
+ if (flowEntryObj == null) {
+ conn.endTx(Transaction.COMMIT);
return false;
+ }
//
// Set the Flow Entry key:
@@ -490,6 +494,7 @@
// TODO: We need a proper Flow ID allocation mechanism.
//
flowId.setValue(flowPath.flowId().value());
+
return true;
}
@@ -521,8 +526,10 @@
conn.endTx(Transaction.ROLLBACK);
log.error(":deleteFlow FlowId:{} failed", flowId.toString());
}
- if (flowObj == null)
+ if (flowObj == null) {
+ conn.endTx(Transaction.COMMIT);
return true; // OK: No such flow
+ }
//
// Find and mark for deletion all Flow Entries
@@ -567,8 +574,10 @@
conn.endTx(Transaction.ROLLBACK);
log.error(":clearFlow FlowId:{} failed", flowId.toString());
}
- if (flowObj == null)
+ if (flowObj == null) {
+ conn.endTx(Transaction.COMMIT);
return true; // OK: No such flow
+ }
//
// Remove all Flow Entries
@@ -608,8 +617,10 @@
conn.endTx(Transaction.ROLLBACK);
log.error(":getFlow FlowId:{} failed", flowId.toString());
}
- if (flowObj == null)
+ if (flowObj == null) {
+ conn.endTx(Transaction.COMMIT);
return null; // Flow not found
+ }
//
// Extract the Flow state
@@ -741,8 +752,10 @@
conn.endTx(Transaction.ROLLBACK);
log.error(":getAllFlowPaths failed");
}
- if ((flowPathsObj == null) || (flowPathsObj.iterator().hasNext() == false))
+ if ((flowPathsObj == null) || (flowPathsObj.iterator().hasNext() == false)) {
+ conn.endTx(Transaction.COMMIT);
return null; // No Flows found
+ }
ArrayList<FlowPath> flowPaths = new ArrayList<FlowPath>();
for (IFlowPath flowObj : flowPathsObj) {