Bug 509: Fixed order of invoking Schema listeners. 37/5937/1
authorTony Tkacik <ttkacik@cisco.com>
Mon, 7 Apr 2014 10:31:55 +0000 (12:31 +0200)
committerTony Tkacik <ttkacik@cisco.com>
Mon, 7 Apr 2014 10:34:30 +0000 (12:34 +0200)
Explicitly registered SchemaServiceListeners
are invoked before listeners picked-up by whiteboard
pattern, which by default are not aware
of the service.

Change-Id: Id41b89a1ba2ccb5323d5ab5ad8a95d2048776679
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/GlobalBundleScanningSchemaServiceImpl.java

index a60a30d..dab8fd5 100644 (file)
@@ -135,6 +135,13 @@ public class GlobalBundleScanningSchemaServiceImpl implements //
 
     private void updateContext(final SchemaContext snapshot) {
         Object[] services = listenerTracker.getServices();
 
     private void updateContext(final SchemaContext snapshot) {
         Object[] services = listenerTracker.getServices();
+        for (ListenerRegistration<SchemaServiceListener> listener : listeners) {
+            try {
+                listener.getInstance().onGlobalContextUpdated(snapshot);
+            } catch (Exception e) {
+                logger.error("Exception occured during invoking listener", e);
+            }
+        }
         if (services != null) {
             for (Object rawListener : services) {
                 SchemaServiceListener listener = (SchemaServiceListener) rawListener;
         if (services != null) {
             for (Object rawListener : services) {
                 SchemaServiceListener listener = (SchemaServiceListener) rawListener;
@@ -145,13 +152,6 @@ public class GlobalBundleScanningSchemaServiceImpl implements //
                 }
             }
         }
                 }
             }
         }
-        for (ListenerRegistration<SchemaServiceListener> listener : listeners) {
-            try {
-                listener.getInstance().onGlobalContextUpdated(snapshot);
-            } catch (Exception e) {
-                logger.error("Exception occured during invoking listener", e);
-            }
-        }
     }
 
     private class BundleScanner implements BundleTrackerCustomizer<ImmutableSet<Registration<URL>>> {
     }
 
     private class BundleScanner implements BundleTrackerCustomizer<ImmutableSet<Registration<URL>>> {

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.