Fix toward Bug #359

Capture exceptions when running the two threads that maintain
the Flow Entries and the Flows in the Network MAP.

Reviewed by: Jono
diff --git a/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java b/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java
index 4d00443..c562556 100644
--- a/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java
+++ b/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java
@@ -100,6 +100,16 @@
 
     final Runnable mapReader = new Runnable() {
 	    public void run() {
+		try {
+		    runImpl();
+		} catch (Exception e) {
+		    log.debug("Exception processing All Flow Entries from the Network MAP: ", e);
+		    conn.endTx(Transaction.ROLLBACK);
+		    return;
+		}
+	    }
+
+	    private void runImpl() {
 		long startTime = System.nanoTime();
 		int counterAllFlowEntries = 0;
 		int counterMyNotUpdatedFlowEntries = 0;
@@ -236,6 +246,16 @@
 
     final Runnable shortestPathReconcile = new Runnable() {
 	    public void run() {
+		try {
+		    runImpl();
+		} catch (Exception e) {
+		    log.debug("Exception processing All Flows from the Network MAP: ", e);
+		    conn.endTx(Transaction.ROLLBACK);
+		    return;
+		}
+	    }
+
+	    private void runImpl() {
 		long startTime = System.nanoTime();
 		int counterAllFlowPaths = 0;
 		int counterMyFlowPaths = 0;