use of org.opendaylight.controller.sal.core.api.BrokerService in project controller by opendaylight.
the class BindingTestContext method startDomBroker.
private void startDomBroker() {
checkState(this.executor != null);
this.domRouter = new DOMRpcRouter();
this.mockSchemaService.registerSchemaContextListener(this.domRouter);
final ClassToInstanceMap<BrokerService> services = MutableClassToInstanceMap.create();
services.put(DOMRpcService.class, this.domRouter);
this.biBrokerImpl = new BrokerImpl(this.domRouter, services);
}
use of org.opendaylight.controller.sal.core.api.BrokerService in project controller by opendaylight.
the class DomBrokerImplModule method createInstance.
@Override
@SuppressWarnings("checkstyle:IllegalCatch")
public AutoCloseable createInstance() {
// The services are provided via blueprint so retrieve then from the OSGi service registry for
// backwards compatibility.
final List<AutoCloseable> closeables = new ArrayList<>();
DOMNotificationService domNotificationService = newTracker(DOMNotificationService.class, closeables).waitForService(WaitingServiceTracker.FIVE_MINUTES);
DOMNotificationPublishService domNotificationPublishService = newTracker(DOMNotificationPublishService.class, closeables).waitForService(WaitingServiceTracker.FIVE_MINUTES);
DOMRpcService domRpcService = newTracker(DOMRpcService.class, closeables).waitForService(WaitingServiceTracker.FIVE_MINUTES);
DOMRpcProviderService domRpcProvider = newTracker(DOMRpcProviderService.class, closeables).waitForService(WaitingServiceTracker.FIVE_MINUTES);
DOMMountPointService mountService = newTracker(DOMMountPointService.class, closeables).waitForService(WaitingServiceTracker.FIVE_MINUTES);
SchemaService globalSchemaService = newTracker(SchemaService.class, closeables).waitForService(WaitingServiceTracker.FIVE_MINUTES);
final DOMDataBroker dataBroker = getAsyncDataBrokerDependency();
final ClassToInstanceMap<BrokerService> services = MutableClassToInstanceMap.create();
services.putInstance(DOMNotificationService.class, domNotificationService);
services.putInstance(DOMNotificationPublishService.class, domNotificationPublishService);
final SchemaService schemaService = getSchemaServiceImpl(globalSchemaService);
services.putInstance(SchemaService.class, schemaService);
services.putInstance(DOMDataBroker.class, dataBroker);
services.putInstance(DOMRpcService.class, domRpcService);
services.putInstance(DOMRpcProviderService.class, domRpcProvider);
services.putInstance(DOMMountPointService.class, mountService);
BrokerImpl broker = new BrokerImpl(domRpcService, domRpcProvider, services);
broker.setDeactivator(() -> {
for (AutoCloseable ac : closeables) {
try {
ac.close();
} catch (Exception e) {
LOG.warn("Exception while closing {}", ac, e);
}
}
});
return broker;
}
use of org.opendaylight.controller.sal.core.api.BrokerService in project controller by opendaylight.
the class ConsumerContextImpl method close.
@Override
public void close() {
if (closed.compareAndSet(false, true)) {
Collection<BrokerService> toStop = instantiatedServices.values();
for (BrokerService brokerService : toStop) {
if (brokerService instanceof AbstractBrokerServiceProxy<?>) {
((AbstractBrokerServiceProxy<?>) brokerService).close();
}
}
broker.consumerSessionClosed(this);
}
}
Aggregations