From: Giovanni Meo Date: Thu, 8 Aug 2013 09:48:24 +0000 (+0200) Subject: StatisticsManager "started" method may fail X-Git-Tag: releasepom-0.1.0~219 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=cadd31f02f414c8f62ab0919d1966ec1fec8ebe0 StatisticsManager "started" method may fail "started" method in the org.opendaylight.controller.statisticsmanager.internal.StatisticsManager occasionally can fail to complete, this is because the method tries to "put" data in clustered caches without checking if the value being inserted is null or no. Infinispan caches in fact don't support null value insertion and hence an exception is thrown preventing subsequent calls to continue. The fix is make sure we don't insert NULL values. Change-Id: I0037931d73e7e7df9535ef83509e770b45e81c72 Signed-off-by: Giovanni Meo --- diff --git a/opendaylight/statisticsmanager/implementation/src/main/java/org/opendaylight/controller/statisticsmanager/internal/StatisticsManager.java b/opendaylight/statisticsmanager/implementation/src/main/java/org/opendaylight/controller/statisticsmanager/internal/StatisticsManager.java index eec183d595..57dfa91b96 100644 --- a/opendaylight/statisticsmanager/implementation/src/main/java/org/opendaylight/controller/statisticsmanager/internal/StatisticsManager.java +++ b/opendaylight/statisticsmanager/implementation/src/main/java/org/opendaylight/controller/statisticsmanager/internal/StatisticsManager.java @@ -170,13 +170,25 @@ public class StatisticsManager implements IStatisticsManager, IReadServiceListen // Retrieve current statistics so we don't have to wait for next refresh ISwitchManager switchManager = (ISwitchManager) ServiceHelper.getInstance( ISwitchManager.class, container.getName(), this); - if (reader != null && switchManager != null) { + if ((reader != null) && (switchManager != null)) { Set nodeSet = switchManager.getNodes(); for (Node node : nodeSet) { - flowStatistics.put(node, reader.readAllFlows(node)); - descriptionStatistics.put(node, reader.readDescription(node)); - tableStatistics.put(node, reader.readNodeTable(node)); - nodeConnectorStatistics.put(node, reader.readNodeConnectors(node)); + List flows = reader.readAllFlows(node); + if (flows != null) { + flowStatistics.put(node, flows); + } + NodeDescription descr = reader.readDescription(node); + if (descr != null) { + descriptionStatistics.put(node, descr); + } + List tableStats = reader.readNodeTable(node); + if (tableStats != null) { + tableStatistics.put(node, tableStats); + } + List ncStats = reader.readNodeConnectors(node); + if (ncStats != null) { + nodeConnectorStatistics.put(node, ncStats); + } } } else {