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;
}
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;
/**
*
public final class SchemaServiceImplSingletonModule extends
org.opendaylight.controller.config.yang.md.sal.dom.impl.AbstractSchemaServiceImplSingletonModule {
+ private static final Logger LOG = LoggerFactory.getLogger(SchemaServiceImplSingletonModule.class);
+
BundleContext bundleContext;
public SchemaServiceImplSingletonModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
public void close() throws Exception {
if (delegate != null) {
delegate = null;
- bundleContext.ungetService(reference);
+
+ try {
+ bundleContext.ungetService(reference);
+ } catch (IllegalStateException e) {
+ // Indicates the service was already unregistered which can happen normally
+ // on shutdown.
+ LOG.debug( "Error unregistering service", e );
+ }
+
reference = null;
bundleContext = null;
}
}
+ @Override
public void addModule(Module arg0) {
delegate.addModule(arg0);
}
+ @Override
public SchemaContext getGlobalContext() {
return delegate.getGlobalContext();
}
+ @Override
public SchemaContext getSessionContext() {
return delegate.getSessionContext();
}
+ @Override
public ListenerRegistration<SchemaServiceListener> registerSchemaServiceListener(SchemaServiceListener arg0) {
return delegate.registerSchemaServiceListener(arg0);
}
+ @Override
public void removeModule(Module arg0) {
delegate.removeModule(arg0);
}