X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fprotocol_plugins%2Fopenflow%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fprotocol_plugin%2Fopenflow%2Finternal%2FOFStatisticsManager.java;h=3ab38cc41f6db686b273864801c238f3cb36eb11;hp=b63517b8add5d90a4df4aecd386c63767fd47e50;hb=0d1d688ac55acc55c3909c52c2cdb940cfb3764f;hpb=eed57e2b0afd50823bc882123b6cbac04bcc48d9 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 b63517b8ad..3ab38cc41f 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 @@ -36,6 +36,7 @@ import org.opendaylight.controller.protocol_plugin.openflow.core.ISwitch; import org.opendaylight.controller.protocol_plugin.openflow.vendorextension.v6extension.V6Match; import org.opendaylight.controller.protocol_plugin.openflow.vendorextension.v6extension.V6StatsReply; import org.opendaylight.controller.protocol_plugin.openflow.vendorextension.v6extension.V6StatsRequest; +import org.opendaylight.controller.sal.connection.IPluginOutConnectionService; import org.opendaylight.controller.sal.core.Node; import org.opendaylight.controller.sal.core.NodeConnector; import org.opendaylight.controller.sal.core.Property; @@ -97,7 +98,7 @@ IInventoryShimExternalListener, CommandProvider { private ConcurrentMap switchSupportsVendorExtStats; // Per port sampled (every portStatsPeriod) transmit rate private Map> txRates; - private Set statisticsListeners; + private Set statisticsListeners = new CopyOnWriteArraySet(); /** * The object containing the latest factoredSamples tx rate samples for a @@ -155,6 +156,32 @@ IInventoryShimExternalListener, CommandProvider { } } + private short getStatsQueueSize() { + String statsQueueSizeStr = System.getProperty("of.statsQueueSize"); + short statsQueueSize = INITIAL_SIZE; + if (statsQueueSizeStr != null) { + try { + statsQueueSize = Short.parseShort(statsQueueSizeStr); + if (statsQueueSize <= 0) { + statsQueueSize = INITIAL_SIZE; + } + } catch (Exception e) { + } + } + return statsQueueSize; + } + + IPluginOutConnectionService connectionPluginOutService; + void setIPluginOutConnectionService(IPluginOutConnectionService s) { + connectionPluginOutService = s; + } + + void unsetIPluginOutConnectionService(IPluginOutConnectionService s) { + if (connectionPluginOutService == s) { + connectionPluginOutService = null; + } + } + /** * Function called by the dependency manager when all the required * dependencies are satisfied @@ -166,17 +193,16 @@ IInventoryShimExternalListener, CommandProvider { portStatistics = new ConcurrentHashMap>(); tableStatistics = new ConcurrentHashMap>(); dummyList = new ArrayList(1); + pendingStatsRequests = new LinkedBlockingQueue(getStatsQueueSize()); statisticsTimerTicks = new ConcurrentHashMap(INITIAL_SIZE); - pendingStatsRequests = new LinkedBlockingQueue(INITIAL_SIZE); switchPortStatsUpdated = new LinkedBlockingQueue(INITIAL_SIZE); switchSupportsVendorExtStats = new ConcurrentHashMap(INITIAL_SIZE); txRates = new HashMap>(INITIAL_SIZE); - statisticsListeners = new CopyOnWriteArraySet(); configStatsPollIntervals(); // Initialize managed timers - statisticsTimer = new Timer(); + statisticsTimer = new Timer("Statistics Timer Ticks"); statisticsTimerTask = new TimerTask() { @Override public void run() { @@ -195,6 +221,7 @@ IInventoryShimExternalListener, CommandProvider { } catch (InterruptedException e) { log.warn("Flow Statistics Collector thread " + "interrupted", e); + return; } } } @@ -210,6 +237,7 @@ IInventoryShimExternalListener, CommandProvider { updatePortsTxRate(switchId); } catch (InterruptedException e) { log.warn("TX Rate Updater thread interrupted", e); + return; } } } @@ -223,6 +251,7 @@ IInventoryShimExternalListener, CommandProvider { * */ void destroy() { + statisticsListeners.clear(); } /** @@ -537,11 +566,10 @@ IInventoryShimExternalListener, CommandProvider { values = this.v6StatsListToOFStatsList(values); } - if (!values.isEmpty()) { //possiblly filtered out by v6StatsListToOFStatsList() - for (IOFStatisticsListener l : this.statisticsListeners) { - l.flowStatisticsRefreshed(switchId, values); - } + for (IOFStatisticsListener l : this.statisticsListeners) { + l.flowStatisticsRefreshed(switchId, values); } + } private void notifyPortUpdate(Long switchId, List values) {