X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=applications%2Fnotification-supplier%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Fapplications%2Fnotification%2Fsupplier%2Fimpl%2FAbstractNotificationSupplierForItemRoot.java;h=bd58e15e0dc585af64bfd8cdfa9644c1490ed430;hb=cfe3a97837951ebbedb337dc988027f10c49f714;hp=92f05a2723f0c4a661291f335191aef1b8294f81;hpb=f61c62231e8d4fe88a3e0180a7e53f92c5e8652c;p=openflowplugin.git diff --git a/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/AbstractNotificationSupplierForItemRoot.java b/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/AbstractNotificationSupplierForItemRoot.java index 92f05a2723..bd58e15e0d 100644 --- a/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/AbstractNotificationSupplierForItemRoot.java +++ b/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/AbstractNotificationSupplierForItemRoot.java @@ -5,15 +5,14 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.openflowplugin.applications.notification.supplier.impl; import com.google.common.base.Preconditions; import java.util.Collection; -import org.opendaylight.controller.md.sal.binding.api.DataBroker; -import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; -import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; -import org.opendaylight.controller.sal.binding.api.NotificationProviderService; +import org.opendaylight.mdsal.binding.api.DataBroker; +import org.opendaylight.mdsal.binding.api.DataObjectModification; +import org.opendaylight.mdsal.binding.api.DataTreeModification; +import org.opendaylight.mdsal.binding.api.NotificationPublishService; import org.opendaylight.openflowplugin.applications.notification.supplier.NotificationSupplierForItemRoot; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; @@ -30,7 +29,7 @@ import org.opendaylight.yangtools.yang.binding.Notification; public abstract class AbstractNotificationSupplierForItemRoot extends AbstractNotificationSupplierBase implements NotificationSupplierForItemRoot { - private final NotificationProviderService notificationProviderService; + private final NotificationPublishService notificationProviderService; /** * Default constructor for all Root Item Notification Supplier implementation. @@ -39,7 +38,7 @@ public abstract class AbstractNotificationSupplierForItemRoot clazz) { super(db, clazz); this.notificationProviderService = Preconditions.checkNotNull(notificationProviderService); @@ -75,23 +74,25 @@ public abstract class AbstractNotificationSupplierForItemRoot identifier, O add) { - - final C notif = createNotification(add, identifier); - if (notif != null) { - notificationProviderService.publish(notif); - } + putNotification(createNotification(add, identifier)); } public void remove(InstanceIdentifier identifier, O del) { - final D notif = deleteNotification(identifier.firstIdentifierOf(clazz)); - if (notif != null) { - notificationProviderService.publish(notif); - } + putNotification(deleteNotification(identifier.firstIdentifierOf(clazz))); } public void update(InstanceIdentifier identifier, O before, O after) { //EMPTY NO-OP } + private void putNotification(Notification notif) { + if (notif != null) { + try { + notificationProviderService.putNotification(notif); + } catch (InterruptedException e) { + throw new IllegalStateException("Interrupted while publishing " + notif, e); + } + } + } }