Search in sources :

Example 1 with EventSourceRegistry

use of org.opendaylight.controller.messagebus.spi.EventSourceRegistry in project controller by opendaylight.

the class MessageBusAppImplModule method createInstance.

@Override
public java.lang.AutoCloseable createInstance() {
    final WaitingServiceTracker<EventSourceRegistry> tracker = WaitingServiceTracker.create(EventSourceRegistry.class, bundleContext);
    final EventSourceRegistry service = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
    return new EventSourceRegistry() {

        @Override
        public void close() {
            // We need to close the WaitingServiceTracker however we don't want to close the actual
            // service instance because its life-cycle is controlled via blueprint.
            tracker.close();
        }

        @Override
        public <T extends EventSource> EventSourceRegistration<T> registerEventSource(T eventSource) {
            return service.registerEventSource(eventSource);
        }
    };
}
Also used : EventSource(org.opendaylight.controller.messagebus.spi.EventSource) EventSourceRegistry(org.opendaylight.controller.messagebus.spi.EventSourceRegistry)

Aggregations

EventSource (org.opendaylight.controller.messagebus.spi.EventSource)1 EventSourceRegistry (org.opendaylight.controller.messagebus.spi.EventSourceRegistry)1