From bc312b3f54c8c089fdc2f2f2b8b8bb6903cca038 Mon Sep 17 00:00:00 2001 From: Tom Pantelis Date: Sun, 17 May 2015 20:33:53 -0400 Subject: [PATCH] Reduce SchemaContext updates on shutdown The GlobalBundleScanningSchemaServiceImpl sends out a ton (hundreds) of SchemaContext updates on shutdown. This because the removedBundle method calls tryToUpdateSchemaContext even for bundles that weren't tracked, ie bundles w/o yang URLs. So I added a check`for # URLs > 0. Change-Id: I203047f04ba5761c1927102b3cb0f2e309b6bf77 Signed-off-by: Tom Pantelis --- .../broker/GlobalBundleScanningSchemaServiceImpl.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/GlobalBundleScanningSchemaServiceImpl.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/GlobalBundleScanningSchemaServiceImpl.java index f7a5ea1e95..34c11ddc92 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/GlobalBundleScanningSchemaServiceImpl.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/GlobalBundleScanningSchemaServiceImpl.java @@ -12,6 +12,7 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Optional; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; +import com.google.common.collect.Iterables; import java.net.URL; import java.util.ArrayList; import java.util.Collections; @@ -218,7 +219,15 @@ public class GlobalBundleScanningSchemaServiceImpl implements SchemaContextProvi LOG.warn("Failed do unregister URL {}, proceeding", url, e); } } - tryToUpdateSchemaContext(); + + int numUrls = Iterables.size(urls); + if(numUrls > 0 ) { + if(LOG.isDebugEnabled()) { + LOG.debug("removedBundle: {}, state: {}, # urls: {}", bundle.getSymbolicName(), bundle.getState(), numUrls); + } + + tryToUpdateSchemaContext(); + } } } -- 2.36.6