X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fprotocol_plugins%2Fopenflow%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fprotocol_plugin%2Fopenflow%2Finternal%2FReadService.java;h=f1f5944f379cdd96bf49e2293a52cb1e1d111277;hb=c7551f594c34504fffa0055d3360132577938b38;hp=84f7dd9282ca89cc67eb160a6465712c2b489d8b;hpb=850d5b748e96c2667bb95ce423bdb00083838619;p=controller.git diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/ReadService.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/ReadService.java index 84f7dd9282..f1f5944f37 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/ReadService.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/ReadService.java @@ -9,6 +9,7 @@ package org.opendaylight.controller.protocol_plugin.openflow.internal; +import java.util.Collections; import java.util.Dictionary; import java.util.List; import java.util.Set; @@ -39,7 +40,7 @@ public class ReadService implements IPluginInReadService, IReadFilterInternalLis private static final Logger logger = LoggerFactory .getLogger(ReadService.class); private IReadServiceFilter filter; - private Set pluginOutReadServices; + private Set pluginOutReadServices = new CopyOnWriteArraySet(); private String containerName; private IPluginOutConnectionService connectionOutService; @@ -51,9 +52,7 @@ public class ReadService implements IPluginInReadService, IReadFilterInternalLis @SuppressWarnings("unchecked") void init(Component c) { Dictionary props = c.getServiceProperties(); - containerName = (props != null) ? (String) props.get("containerName") - : null; - pluginOutReadServices = new CopyOnWriteArraySet(); + containerName = (props != null) ? (String) props.get("containerName") : null; } /** @@ -63,6 +62,7 @@ public class ReadService implements IPluginInReadService, IReadFilterInternalLis * */ void destroy() { + pluginOutReadServices.clear(); } /** @@ -123,12 +123,12 @@ public class ReadService implements IPluginInReadService, IReadFilterInternalLis public List readAllFlow(Node node, boolean cached) { if (!node.getType().equals(NodeIDType.OPENFLOW)) { logger.error("Invalid node type"); - return null; + return Collections.emptyList(); } if (!connectionOutService.isLocal(node)) { logger.debug("This Controller is not the master for the node : " + node); - return null; + return Collections.emptyList(); } return filter.readAllFlow(containerName, node, cached); @@ -171,12 +171,12 @@ public class ReadService implements IPluginInReadService, IReadFilterInternalLis boolean cached) { if (!node.getType().equals(NodeIDType.OPENFLOW)) { logger.error("Invalid node type"); - return null; + return Collections.emptyList(); } if (!connectionOutService.isLocal(node)) { logger.debug("This Controller is not the master for node : " + node); - return null; + return Collections.emptyList(); } return filter.readAllNodeConnector(containerName, node, cached); @@ -218,12 +218,12 @@ public class ReadService implements IPluginInReadService, IReadFilterInternalLis public List readAllNodeTable(Node node, boolean cached) { if (!node.getType().equals(NodeIDType.OPENFLOW)) { logger.error("Invalid node type"); - return null; + return Collections.emptyList(); } if (!connectionOutService.isLocal(node)) { logger.debug("This Controller is not the master for node : " + node); - return null; + return Collections.emptyList(); } return filter.readAllNodeTable(containerName, node, cached);