BUG-997: migrate the global context schema service 43/9543/9
authorRobert Varga <rovarga@cisco.com>
Thu, 31 Jul 2014 15:47:47 +0000 (17:47 +0200)
committerTony Tkacik <ttkacik@cisco.com>
Fri, 5 Sep 2014 07:54:52 +0000 (07:54 +0000)
This change test-drives the new re-implementation, making sure we have a
user. An immediate advantage should be faster context convergence times.
Requires I3311a3f0251868f91c385d0291365934ccfb9ede in yangtools.

Change-Id: Ic2f07144043f456ab9821013c1d690904c9a791f
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/GlobalBundleScanningSchemaServiceImpl.java

index c4418c7911a79b6d786c7a47a638e87ceffa59bc..4911bfe60308d95ba7546af1a65f86d44809bed1 100644 (file)
@@ -28,7 +28,7 @@ import org.opendaylight.yangtools.util.ListenerRegistry;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
-import org.opendaylight.yangtools.yang.parser.impl.util.URLSchemaContextResolver;
+import org.opendaylight.yangtools.yang.parser.repo.URLSchemaContextResolver;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleEvent;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleEvent;
@@ -44,7 +44,7 @@ public class GlobalBundleScanningSchemaServiceImpl implements SchemaContextProvi
     private static final Logger LOG = LoggerFactory.getLogger(GlobalBundleScanningSchemaServiceImpl.class);
 
     private final ListenerRegistry<SchemaContextListener> listeners = new ListenerRegistry<>();
     private static final Logger LOG = LoggerFactory.getLogger(GlobalBundleScanningSchemaServiceImpl.class);
 
     private final ListenerRegistry<SchemaContextListener> listeners = new ListenerRegistry<>();
-    private final URLSchemaContextResolver contextResolver = new URLSchemaContextResolver();
+    private final URLSchemaContextResolver contextResolver = URLSchemaContextResolver.create("global-bundle");
     private final BundleScanner scanner = new BundleScanner();
     private final BundleContext context;
 
     private final BundleScanner scanner = new BundleScanner();
     private final BundleContext context;
 
@@ -233,7 +233,7 @@ public class GlobalBundleScanningSchemaServiceImpl implements SchemaContextProvi
         if (starting) {
             return;
         }
         if (starting) {
             return;
         }
-        Optional<SchemaContext> schema = contextResolver.tryToUpdateSchemaContext();
+        Optional<SchemaContext> schema = contextResolver.getSchemaContext();
         if(schema.isPresent()) {
             updateContext(schema.get());
         }
         if(schema.isPresent()) {
             updateContext(schema.get());
         }