On close, the GlobalBundleScanningSchemaServiceImpl closes the
BundleTracker which untracks all the bundles and notifies the listener
of removed bundles. This results in a call to tryToUpdateSchemaContext
which causes the remaining yang files to be re-parsed to build a new
SchemaContext. To prevent this extra processing on shutdown, I added
a "stopping" flag to elide tryToUpdateSchemaContext the same we do
with the "starting" flag.
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
Change-Id: I9f7c05277df9bf1ffaec1c699453020312aab203
private ServiceTracker<SchemaContextListener, SchemaContextListener> listenerTracker;
private BundleTracker<Iterable<Registration>> bundleTracker;
private boolean starting = true;
+ private volatile boolean stopping;
private static GlobalBundleScanningSchemaServiceImpl instance;
private GlobalBundleScanningSchemaServiceImpl(final BundleContext context) {
@Override
public void close() {
+ stopping = true;
if (bundleTracker != null) {
bundleTracker.close();
}
}
public synchronized void tryToUpdateSchemaContext() {
- if (starting) {
+ if (starting || stopping) {
return;
}
Optional<SchemaContext> schema = contextResolver.getSchemaContext();