- List<OFStatistics> values = this.acquireStatistics(switchId, statType,
- null);
-
- // Update local caching database if got a valid response
- if (values != null && !values.isEmpty()) {
- if ((statType == OFStatisticsType.FLOW)
- || (statType == OFStatisticsType.VENDOR)) {
- flowStatistics.put(switchId, values);
- } else if (statType == OFStatisticsType.DESC) {
- // Notify who may be interested in a description change
- notifyDescriptionListeners(switchId, values);
-
- // Overwrite cache
- descStatistics.put(switchId, values);
- } else if (statType == OFStatisticsType.PORT) {
- // Overwrite cache with new port statistics for this switch
- portStatistics.put(switchId, values);
-
- // Wake up the thread which maintains the TX byte counters for
- // each port
- switchPortStatsUpdated.offer(switchId);
+ List<OFStatistics> values = this.fetchStatisticsFromSwitch(switchId, statType, null);
+
+ // If got a valid response update local cache and notify listeners
+ if (!values.isEmpty()) {
+ switch (statType) {
+ case FLOW:
+ case VENDOR:
+ flowStatistics.put(switchId, values);
+ notifyFlowUpdate(switchId, values);
+ break;
+ case DESC:
+ // Overwrite cache
+ descStatistics.put(switchId, values);
+ // Notify who may be interested in a description change
+ notifyDescriptionUpdate(switchId, values);
+ break;
+ case PORT:
+ // Overwrite cache with new port statistics for this switch
+ portStatistics.put(switchId, values);
+
+ // Wake up the thread which maintains the TX byte counters for
+ // each port
+ switchPortStatsUpdated.offer(switchId);
+ notifyPortUpdate(switchId, values);
+ break;
+ case TABLE:
+ // Overwrite cache
+ tableStatistics.put(switchId, values);
+ notifyTableUpdate(switchId, values);
+ break;
+ default: