From: Madhu Venugopal Date: Thu, 4 Sep 2014 13:26:01 +0000 (+0000) Subject: Merge "Fix build issue due to implicit addition of unneccessary Import-Package" X-Git-Tag: release/helium~149 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=737ce4f787f3265a91316b45f8efe55779ad1e09;hp=2aa22bd64226e77ba51997e4e499e5d758021859 Merge "Fix build issue due to implicit addition of unneccessary Import-Package" --- 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 82637327f6..c4418c7911 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 @@ -10,6 +10,10 @@ package org.opendaylight.controller.sal.dom.broker; import static com.google.common.base.Preconditions.checkState; 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 java.net.URL; import java.util.ArrayList; import java.util.Collections; @@ -20,7 +24,7 @@ import org.opendaylight.controller.sal.core.api.model.SchemaService; import org.opendaylight.controller.sal.dom.broker.impl.SchemaContextProvider; import org.opendaylight.yangtools.concepts.ListenerRegistration; import org.opendaylight.yangtools.concepts.Registration; -import org.opendaylight.yangtools.concepts.util.ListenerRegistry; +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; @@ -36,10 +40,6 @@ import org.osgi.util.tracker.ServiceTrackerCustomizer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.common.base.Optional; -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; - public class GlobalBundleScanningSchemaServiceImpl implements SchemaContextProvider, SchemaService, ServiceTrackerCustomizer, AutoCloseable { private static final Logger LOG = LoggerFactory.getLogger(GlobalBundleScanningSchemaServiceImpl.class); @@ -71,7 +71,11 @@ public class GlobalBundleScanningSchemaServiceImpl implements SchemaContextProvi @VisibleForTesting public static synchronized void destroyInstance() { - instance = null; + try { + instance.close(); + } finally { + instance = null; + } } public BundleContext getContext() { @@ -124,16 +128,18 @@ public class GlobalBundleScanningSchemaServiceImpl implements SchemaContextProvi } @Override - public void close() throws Exception { + public void close() { if (bundleTracker != null) { bundleTracker.close(); } if (listenerTracker != null) { listenerTracker.close(); } - // FIXME: Add listeners.close(); - } + for (ListenerRegistration l : listeners.getListeners()) { + l.close(); + } + } private synchronized void updateContext(final SchemaContext snapshot) { Object[] services = listenerTracker.getServices();