BUG-650: remove unneeded sort()
[controller.git] / opendaylight / sal / implementation / src / main / java / org / opendaylight / controller / sal / implementation / internal / ReadService.java
index ed0394d2096aed52f93232def9137c9f4d3daf5f..12de35f53677492581412017e9c763de96a05c0b 100644 (file)
@@ -12,6 +12,7 @@ package org.opendaylight.controller.sal.implementation.internal;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -59,8 +60,10 @@ import org.slf4j.LoggerFactory;
 public class ReadService implements IReadService, CommandProvider, IPluginOutReadService {
 
     protected static final Logger logger = LoggerFactory.getLogger(ReadService.class);
-    private ConcurrentHashMap<String, IPluginInReadService> pluginReader;
-    private Set<IReadServiceListener> readerListeners;
+    private ConcurrentHashMap<String, IPluginInReadService> pluginReader =
+        new ConcurrentHashMap<String, IPluginInReadService>();
+    private Set<IReadServiceListener> readerListeners =
+        new CopyOnWriteArraySet<IReadServiceListener>();
 
     /**
      * Function called by the dependency manager when all the required
@@ -68,8 +71,6 @@ public class ReadService implements IReadService, CommandProvider, IPluginOutRea
      *
      */
     void init() {
-        pluginReader = new ConcurrentHashMap<String, IPluginInReadService>();
-        readerListeners = new CopyOnWriteArraySet<IReadServiceListener>();
     }
 
     /**
@@ -82,6 +83,7 @@ public class ReadService implements IReadService, CommandProvider, IPluginOutRea
         // In case of plugin disactivating make sure we clear the
         // dependencies
         this.pluginReader.clear();
+        this.readerListeners.clear();
     }
 
     /**
@@ -200,7 +202,7 @@ public class ReadService implements IReadService, CommandProvider, IPluginOutRea
             }
         }
         logger.warn("Plugin {} unavailable", node.getType());
-        return null;
+        return Collections.emptyList();
     }
 
     @Override
@@ -212,7 +214,7 @@ public class ReadService implements IReadService, CommandProvider, IPluginOutRea
             }
         }
         logger.warn("Plugin {} unavailable", node.getType());
-        return null;
+        return Collections.emptyList();
     }
 
     @Override
@@ -275,7 +277,7 @@ public class ReadService implements IReadService, CommandProvider, IPluginOutRea
             }
         }
         logger.warn("Plugin {} unavailable", node.getType());
-        return null;
+        return Collections.emptyList();
     }
 
     @Override
@@ -287,7 +289,7 @@ public class ReadService implements IReadService, CommandProvider, IPluginOutRea
             }
         }
         logger.warn("Plugin {} unavailable", node.getType());
-        return null;
+        return Collections.emptyList();
     }
 
 
@@ -326,7 +328,7 @@ public class ReadService implements IReadService, CommandProvider, IPluginOutRea
             }
         }
         logger.warn("Plugin {} unavailable", node.getType());
-        return null;
+        return Collections.emptyList();
     }
 
     @Override
@@ -383,16 +385,15 @@ public class ReadService implements IReadService, CommandProvider, IPluginOutRea
     public String getHelp() {
         StringBuffer help = new StringBuffer();
         help.append("---SAL Reader testing commands---\n");
-        help
-        .append("\t readflows <sid> <cached>  - Read all the (cached) flows from the openflow switch <sid>\n");
-        help
-        .append("\t readflow  <sid> <cached>  - Read the (cached) sample flow from the openflow switch <sid>\n");
-        help
-        .append("\t readdesc  <sid> <cached>  - Read the (cached) description from openflow switch <sid>\n");
-        help
-        .append("\t           cached=true/false. If false or not specified, the protocol plugin cached info\n");
-        help
-        .append("\t           is returned. If true, the info is directly retrieved from the switch\n");
+        help.append("\t readflows <sid> <cached> - Read all the (cached) flows from the openflow switch <sid>\n");
+        help.append("\t readflow  <sid> <cached> - Read the (cached) sample flow from the openflow switch <sid>\n");
+        help.append("\t readdescr <sid> <cached> - Read the (cached) description from openflow switch <sid>\n");
+        help.append("\t\t cached = (true|false). If false or not specified, the plugin cached info\n");
+        help.append("\t\t is returned. If true, the info is directly retrieved from the switch\n");
+        help.append("\t readport <sid> <port>    - Read port statistics for the specified port\n");
+        help.append("\t readports <sid>          - Read port statistics for all ports of specified switch\n");
+        help.append("\t readtable <sid> <tableid>- Read specified table statistics\n");
+
         return help.toString();
     }