From cba872bacd7963de38208fde9f37747820340d00 Mon Sep 17 00:00:00 2001 From: Asad Ahmed Date: Fri, 2 Aug 2013 15:40:33 -0700 Subject: [PATCH] This is a fix for the latch to countdown in case of exceptions and error conditions so that we dont wait indefinitely Change-Id: Ic37adf700d92ce8a0c84726492643d8728d20ad2 Signed-off-by: Asad Ahmed --- .../openflow/core/internal/StatisticsCollector.java | 3 ++- .../protocol_plugin/openflow/core/internal/SwitchHandler.java | 4 +++- .../openflow/internal/OFStatisticsManager.java | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/StatisticsCollector.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/StatisticsCollector.java index 98fb803bd8..0eaecc5c56 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/StatisticsCollector.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/StatisticsCollector.java @@ -76,6 +76,7 @@ public class StatisticsCollector implements Callable { } public void wakeup(OFError errorMsg) { - + result = errorMsg; + wakeup(); } } diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/SwitchHandler.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/SwitchHandler.java index 3fa2513656..52ea7fd575 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/SwitchHandler.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/SwitchHandler.java @@ -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 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.ISwitch; 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 + worker.wakeup(); return result; } } @@ -937,6 +938,7 @@ public class SwitchHandler implements ISwitch { // convert the result into a Boolean with value false status = false; result = status; + worker.wakeup(); return result; } } diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/OFStatisticsManager.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/OFStatisticsManager.java index e3a1ffec96..635a8bce7c 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/OFStatisticsManager.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/OFStatisticsManager.java @@ -203,7 +203,7 @@ IInventoryShimExternalListener, CommandProvider { configStatsPollIntervals(); // Initialize managed timers - statisticsTimer = new Timer(); + statisticsTimer = new Timer("Statistics Timer Ticks"); statisticsTimerTask = new TimerTask() { @Override public void run() { @@ -222,6 +222,7 @@ IInventoryShimExternalListener, CommandProvider { } 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); + return; } } } -- 2.36.6