Fixed a bug that FlowPusher remains SUSPENDED state when flow synchronization fails.
Change-Id: Ie0e9b950039702e7a85de1f2b0c63da3a8a4e03f
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowSynchronizer.java b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowSynchronizer.java
index 6e30a88..16a654f 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowSynchronizer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowSynchronizer.java
@@ -98,25 +98,28 @@
@Override
public SyncResult call() {
pusher.suspend(sw);
- long start = System.nanoTime();
- Set<FlowEntryWrapper> graphEntries = getFlowEntriesFromGraph();
- long step1 = System.nanoTime();
- Set<FlowEntryWrapper> switchEntries = getFlowEntriesFromSwitch();
- if (switchEntries == null) {
- log.debug("getFlowEntriesFromSwitch() failed");
- return null;
+ try {
+ long start = System.nanoTime();
+ Set<FlowEntryWrapper> graphEntries = getFlowEntriesFromGraph();
+ long step1 = System.nanoTime();
+ Set<FlowEntryWrapper> switchEntries = getFlowEntriesFromSwitch();
+ if (switchEntries == null) {
+ log.debug("getFlowEntriesFromSwitch() failed");
+ return null;
+ }
+ long step2 = System.nanoTime();
+ SyncResult result = compare(graphEntries, switchEntries);
+ long step3 = System.nanoTime();
+ graphIDTime = (step1 - start);
+ switchTime = (step2 - step1);
+ compareTime = (step3 - step2);
+ totalTime = (step3 - start);
+ outputTime();
+
+ return result;
+ } finally {
+ pusher.resume(sw);
}
- long step2 = System.nanoTime();
- SyncResult result = compare(graphEntries, switchEntries);
- long step3 = System.nanoTime();
- graphIDTime = (step1 - start);
- switchTime = (step2 - step1);
- compareTime = (step3 - step2);
- totalTime = (step3 - start);
- outputTime();
- pusher.resume(sw);
-
- return result;
}
private void outputTime() {