X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-binding-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fbinding%2Fapi%2FNotificationProviderService.java;h=00db80c19f7fd3fc9399dd303df74f7987eb2ce7;hp=b94695b83d437e31194e1e862da479b787ba8d80;hb=fdf7efda11d2b70f74236d26a85893139be0c8f2;hpb=18f8f0b852694daf18e8fd034ba576d78499e0ee diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/NotificationProviderService.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/NotificationProviderService.java index b94695b83d..00db80c19f 100644 --- a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/NotificationProviderService.java +++ b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/NotificationProviderService.java @@ -14,29 +14,62 @@ import org.opendaylight.controller.md.sal.common.api.notify.NotificationPublishS import org.opendaylight.yangtools.concepts.ListenerRegistration; import org.opendaylight.yangtools.yang.binding.Notification; +/** + * Interface for a notification service that provides publish/subscribe capabilities for YANG + * modeled notifications. This interface is a combination of the {@link NotificationService} and + * {@link NotificationPublishService} interfaces. + */ public interface NotificationProviderService extends NotificationService, NotificationPublishService { + /** - * Publishes a notification. - * - * @param Notification - * notification to publish. - * + * {@inheritDoc} */ @Override - void publish(Notification notification); + public void publish(Notification notification); /** - * Publishes a notification, listener calls are done in provided executor. - * + * {@inheritDoc} */ @Override - void publish(Notification notification, ExecutorService service); + void publish(Notification notification, ExecutorService executor); + /** + * Registers a listener to be notified about notification subscriptions. This + * enables a component to know when there is a notification listener subscribed + * for a particular notification type. + *

+ * On registration of this listener, the + * {@link NotificationInterestListener#onNotificationSubscribtion(Class)} method + * will be invoked for every notification type that currently has a notification listener + * subscribed. + * + * @param interestListener the listener that will be notified when subscriptions + * for new notification types occur. + * @return a {@link ListenerRegistration} instance that should be used to unregister the listener + * by invoking the {@link ListenerRegistration#close()} method when no longer needed. + */ ListenerRegistration registerInterestListener( NotificationInterestListener interestListener); + /** + * Interface for a listener interested in being notified about notification subscriptions. + */ public interface NotificationInterestListener extends EventListener { + /** + * Callback that is invoked when a notification listener subscribes for a + * particular notification type. + *

+ * This method is only called for the first subscription that occurs for a + * particular notification type. Subsequent subscriptions for the same + * notification type do not trigger invocation of this method. + *

+ * Note:This callback is delivered from thread not owned by this listener, + * all processing should be as fast as possible and implementations should + * not do any blocking calls or block this thread. + * + * @param notificationType the notification type for the subscription that occurred. + */ void onNotificationSubscribtion(Class notificationType); } }