import org.opendaylight.yangtools.yang.model.api.SchemaServiceListener;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
public final class RuntimeMappingModule extends
org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractRuntimeMappingModule {
+ private static final Logger LOG = LoggerFactory.getLogger(RuntimeMappingModule.class);
+
private BundleContext bundleContext;
public RuntimeMappingModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
}
@Override
- public void close() throws Exception {
+ public void close() {
if(delegate != null) {
delegate = null;
- bundleContext.ungetService(reference);
+
+ try {
+ bundleContext.ungetService(reference);
+ } catch (IllegalStateException e) {
+ // Indicates the BundleContext is no longer valid which can happen normally on shutdown.
+ LOG.debug( "Error unregistering service", e );
+ }
+
bundleContext= null;
reference = null;
}