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 a60a30d25686cad6013277f21e303e2053ccee94..dab8fd5cd10bb71f1d9f9df480b3ec509276cd62 100644 (file)
@@ -135,6 +135,13 @@ public class GlobalBundleScanningSchemaServiceImpl implements //
 
     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;
@@ -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>>> {