import org.opendaylight.controller.md.sal.dom.spi.DOMNotificationSubscriptionListener;
import org.opendaylight.controller.md.sal.dom.spi.DOMNotificationSubscriptionListenerRegistry;
import org.opendaylight.controller.sal.binding.api.NotificationListener;
import org.opendaylight.controller.md.sal.dom.spi.DOMNotificationSubscriptionListener;
import org.opendaylight.controller.md.sal.dom.spi.DOMNotificationSubscriptionListenerRegistry;
import org.opendaylight.controller.sal.binding.api.NotificationListener;
import org.opendaylight.yangtools.concepts.AbstractListenerRegistration;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.util.ListenerRegistry;
import org.opendaylight.yangtools.yang.binding.Notification;
import org.opendaylight.yangtools.concepts.AbstractListenerRegistration;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.util.ListenerRegistry;
import org.opendaylight.yangtools.yang.binding.Notification;
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class HeliumNotificationProviderServiceWithInterestListeners extends HeliumNotificationProviderServiceAdapter {
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class HeliumNotificationProviderServiceWithInterestListeners extends HeliumNotificationProviderServiceAdapter {
private final ListenerRegistry<NotificationInterestListener> interestListeners = ListenerRegistry.create();
private final ListenerRegistration<Listener> domListener;
private final ListenerRegistry<NotificationInterestListener> interestListeners = ListenerRegistry.create();
private final ListenerRegistration<Listener> domListener;
private final BindingToNormalizedNodeCodec codec;
public HeliumNotificationProviderServiceWithInterestListeners(
private final BindingToNormalizedNodeCodec codec;
public HeliumNotificationProviderServiceWithInterestListeners(
- final BindingDOMNotificationPublishServiceAdapter publishService, final BindingDOMNotificationServiceAdapter listenService, final DOMNotificationSubscriptionListenerRegistry registry) {
+ final BindingDOMNotificationPublishServiceAdapter publishService,
+ final BindingDOMNotificationServiceAdapter listenService,
+ final DOMNotificationSubscriptionListenerRegistry registry) {
super(publishService, listenService);
this.codec = publishService.getCodecRegistry();
this.domListener = registry.registerSubscriptionListener(new Listener());
super(publishService, listenService);
this.codec = publishService.getCodecRegistry();
this.domListener = registry.registerSubscriptionListener(new Listener());
- final Iterator<ListenerRegistration<NotificationInterestListener>> listeners = interestListeners.iterator();
- if(listeners.hasNext()) {
+ final Iterator<? extends ListenerRegistration<? extends NotificationInterestListener>> listeners =
+ interestListeners.getRegistrations().iterator();
+ if (listeners.hasNext()) {
- notifyListener(listenerRef,baEvent);
- } catch (final Exception e) {
- LOG.warn("Unhandled exception during invoking listener {}",e, listenerRef);
+ notifyListener(listenerRef, baEvent);
+ } catch (RuntimeException e) {
+ LOG.warn("Unhandled exception during invoking listener {}", listenerRef, e);
public <T extends Notification> ListenerRegistration<NotificationListener<T>> registerNotificationListener(
final Class<T> type, final NotificationListener<T> listener) {
public <T extends Notification> ListenerRegistration<NotificationListener<T>> registerNotificationListener(
final Class<T> type, final NotificationListener<T> listener) {
- final FunctionalNotificationListenerAdapter<T> adapter = new FunctionalNotificationListenerAdapter<>(codec, type, listener);
+ final FunctionalNotificationListenerAdapter<T> adapter =
+ new FunctionalNotificationListenerAdapter<>(codec, type, listener);
final SchemaPath domType = SchemaPath.create(true, BindingReflections.findQName(type));
final ListenerRegistration<?> domReg = domService.registerNotificationListener(adapter, domType);
return new AbstractListenerRegistration<NotificationListener<T>>(listener) {
final SchemaPath domType = SchemaPath.create(true, BindingReflections.findQName(type));
final ListenerRegistration<?> domReg = domService.registerNotificationListener(adapter, domType);
return new AbstractListenerRegistration<NotificationListener<T>>(listener) {
- private void notifyListener(final NotificationInterestListener listener, final Set<Class<? extends Notification>> baEvent) {
- for(final Class<? extends Notification> event: baEvent) {
+ private static void notifyListener(final NotificationInterestListener listener,
+ final Set<Class<? extends Notification>> baEvent) {
+ for (final Class<? extends Notification> event: baEvent) {