This is a fix for the latch to countdown in case of exceptions and 78/778/1
authorAsad Ahmed <asaahmed@cisco.com>
Fri, 2 Aug 2013 22:40:33 +0000 (15:40 -0700)
committerAsad Ahmed <asaahmed@cisco.com>
Fri, 2 Aug 2013 22:44:49 +0000 (15:44 -0700)
error conditions so that we dont wait indefinitely

Change-Id: Ic37adf700d92ce8a0c84726492643d8728d20ad2
Signed-off-by: Asad Ahmed <asaahmed@cisco.com>
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/StatisticsCollector.java
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/SwitchHandler.java
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/OFStatisticsManager.java

index 98fb803bd8305b237de3ac49307e4f852fa11537..0eaecc5c561c1b704f0ef14ce52d90730c5bac57 100644 (file)
@@ -76,6 +76,7 @@ public class StatisticsCollector implements Callable<Object> {
     }
 
     public void wakeup(OFError errorMsg) {
     }
 
     public void wakeup(OFError errorMsg) {
-
+        result = errorMsg;
+        wakeup();
     }
 }
     }
 }
index 3fa251365687ef895601bb301f6e3067bc58a413..52ea7fd575a76ae4f2053c5b1c96c7a10e622c0e 100644 (file)
@@ -36,8 +36,8 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.opendaylight.controller.protocol_plugin.openflow.core.IController;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.opendaylight.controller.protocol_plugin.openflow.core.IController;
-import org.opendaylight.controller.protocol_plugin.openflow.core.ISwitch;
 import org.opendaylight.controller.protocol_plugin.openflow.core.IMessageReadWrite;
 import org.opendaylight.controller.protocol_plugin.openflow.core.IMessageReadWrite;
+import org.opendaylight.controller.protocol_plugin.openflow.core.ISwitch;
 import org.openflow.protocol.OFBarrierReply;
 import org.openflow.protocol.OFBarrierRequest;
 import org.openflow.protocol.OFEchoReply;
 import org.openflow.protocol.OFBarrierReply;
 import org.openflow.protocol.OFBarrierRequest;
 import org.openflow.protocol.OFEchoReply;
@@ -622,6 +622,7 @@ public class SwitchHandler implements ISwitch {
         } catch (Exception e) {
             logger.warn("Timeout while waiting for {} replies", req.getType());
             result = null; // to indicate timeout has occurred
         } catch (Exception e) {
             logger.warn("Timeout while waiting for {} replies", req.getType());
             result = null; // to indicate timeout has occurred
+            worker.wakeup();
             return result;
         }
     }
             return result;
         }
     }
@@ -937,6 +938,7 @@ public class SwitchHandler implements ISwitch {
             // convert the result into a Boolean with value false
             status = false;
             result = status;
             // convert the result into a Boolean with value false
             status = false;
             result = status;
+            worker.wakeup();
             return result;
         }
     }
             return result;
         }
     }
index e3a1ffec96cc28d26b0dcc247763aeef1c06184d..635a8bce7c3ef847b7c20ff1ee293e140087d05d 100644 (file)
@@ -203,7 +203,7 @@ IInventoryShimExternalListener, CommandProvider {
         configStatsPollIntervals();
 
         // Initialize managed timers
         configStatsPollIntervals();
 
         // Initialize managed timers
-        statisticsTimer = new Timer();
+        statisticsTimer = new Timer("Statistics Timer Ticks");
         statisticsTimerTask = new TimerTask() {
             @Override
             public void run() {
         statisticsTimerTask = new TimerTask() {
             @Override
             public void run() {
@@ -222,6 +222,7 @@ IInventoryShimExternalListener, CommandProvider {
                     } catch (InterruptedException e) {
                         log.warn("Flow Statistics Collector thread "
                                 + "interrupted", e);
                     } catch (InterruptedException e) {
                         log.warn("Flow Statistics Collector thread "
                                 + "interrupted", e);
+                        return;
                     }
                 }
             }
                     }
                 }
             }
@@ -237,6 +238,7 @@ IInventoryShimExternalListener, CommandProvider {
                         updatePortsTxRate(switchId);
                     } catch (InterruptedException e) {
                         log.warn("TX Rate Updater thread interrupted", e);
                         updatePortsTxRate(switchId);
                     } catch (InterruptedException e) {
                         log.warn("TX Rate Updater thread interrupted", e);
+                        return;
                     }
                 }
             }
                     }
                 }
             }