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%2FInventoryService.java;h=f983e1244dba519f7a2afc0c6d13f8937f1178bc;hb=dfa4383b0b5c9c6de340526a62aef731922fa29f;hp=9fded15f42383a1edceb436f5c8b010909a6e03b;hpb=d4b6addab23cf24f20cd7969a7f1d800fda2bac1;p=controller.git diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/InventoryService.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/InventoryService.java index 9fded15f42..f983e1244d 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/InventoryService.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/InventoryService.java @@ -22,7 +22,6 @@ import org.opendaylight.controller.protocol_plugin.openflow.IInventoryProvider; import org.opendaylight.controller.protocol_plugin.openflow.IInventoryShimInternalListener; import org.opendaylight.controller.protocol_plugin.openflow.core.IController; import org.opendaylight.controller.protocol_plugin.openflow.core.ISwitch; -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; @@ -45,10 +44,11 @@ public class InventoryService implements IInventoryShimInternalListener, IPluginInInventoryService, IInventoryProvider { protected static final Logger logger = LoggerFactory .getLogger(InventoryService.class); - private Set pluginOutInventoryServices; + private final Set pluginOutInventoryServices = + new CopyOnWriteArraySet(); private IController controller = null; - private ConcurrentMap> nodeProps; // properties are maintained in global container only - private ConcurrentMap> nodeConnectorProps; // properties are maintained in global container only + private ConcurrentMap> nodeProps; + private ConcurrentMap> nodeConnectorProps; private boolean isDefaultContainer = false; private String containerName = null; @@ -82,7 +82,6 @@ public class InventoryService implements IInventoryShimInternalListener, nodeProps = new ConcurrentHashMap>(); nodeConnectorProps = new ConcurrentHashMap>(); - pluginOutInventoryServices = new CopyOnWriteArraySet(); } /** @@ -112,6 +111,7 @@ public class InventoryService implements IInventoryShimInternalListener, */ void stop() { logger.trace("STOP called!"); + pluginOutInventoryServices.clear(); } public void setPluginOutInventoryServices(IPluginOutInventoryService service) { @@ -228,8 +228,9 @@ public class InventoryService implements IInventoryShimInternalListener, private void removeNode(Node node) { logger.trace("{} removed", node); - if (nodeProps == null) + if (nodeProps == null) { return; + } // update local cache nodeProps.remove(node); @@ -252,8 +253,8 @@ public class InventoryService implements IInventoryShimInternalListener, private void updateNode(Node node, Set properties) { logger.trace("{} updated, props: {}", node, properties); - if (nodeProps == null || !nodeProps.containsKey(node) || - properties == null || properties.isEmpty()) { + if ((nodeProps == null) || !nodeProps.containsKey(node) || + (properties == null) || properties.isEmpty()) { return; }