BUG 3057 - notify added event source by topics created before 95/18995/1
authorMarian Adamjak <madamjak@cisco.com>
Fri, 24 Apr 2015 10:50:05 +0000 (12:50 +0200)
committerMarian Adamjak <madamjak@cisco.com>
Fri, 24 Apr 2015 11:20:48 +0000 (13:20 +0200)
Change-Id: I97d49e830af6c360bb2d2b24880aa07e2e47c0a6
Signed-off-by: Marian Adamjak <madamjak@cisco.com>
opendaylight/md-sal/messagebus-impl/src/main/java/org/opendaylight/controller/messagebus/app/impl/EventSourceTopology.java

index 10b9ec83cde9080a5eb652ea69b65936973b0f60..7771b82491f61f90207ac737742538bf370323d0 100644 (file)
@@ -78,10 +78,10 @@ public class EventSourceTopology implements EventAggregatorService, EventSourceR
                     .child(TopologyTypes.class)
                     .augmentation(TopologyTypes1.class);
 
-    private final Map<DataChangeListener, ListenerRegistration<DataChangeListener>> topicListenerRegistrations =
+    private final Map<EventSourceTopic, ListenerRegistration<DataChangeListener>> topicListenerRegistrations =
             new ConcurrentHashMap<>();
     private final Map<NodeKey, RoutedRpcRegistration<EventSourceService>> routedRpcRegistrations =
-            new ConcurrentHashMap<>();;
+            new ConcurrentHashMap<>();
 
     private final DataBroker dataBroker;
     private final RpcRegistration<EventAggregatorService> aggregatorRpcReg;
@@ -205,12 +205,16 @@ public class EventSourceTopology implements EventAggregatorService, EventSourceR
     }
 
     public void register(final EventSource eventSource){
-    NodeKey nodeKey = eventSource.getSourceNodeKey();
+        NodeKey nodeKey = eventSource.getSourceNodeKey();
         final KeyedInstanceIdentifier<Node, NodeKey> sourcePath = EVENT_SOURCE_TOPOLOGY_PATH.child(Node.class, nodeKey);
         RoutedRpcRegistration<EventSourceService> reg = rpcRegistry.addRoutedRpcImplementation(EventSourceService.class, eventSource);
         reg.registerPath(NodeContext.class, sourcePath);
         routedRpcRegistrations.put(nodeKey,reg);
         insert(sourcePath);
+
+        for(EventSourceTopic est : topicListenerRegistrations.keySet()){
+            est.notifyNode(EVENT_SOURCE_TOPOLOGY_PATH.child(Node.class, nodeKey));
+        }
     }
 
     public void unRegister(final EventSource eventSource){