X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-common-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fcommon%2Fapi%2Fnotify%2FNotificationPublishService.java;h=4c5ae16b0db016a8d970c7eaaf4ebd438cdb50d3;hp=f5f03a106b36119b188ca489924d514f88b12f00;hb=3ec97cd0a86ad1b79f6854dc6924eb7b06e359a3;hpb=4f8e371e1b7f6a2aa31115407c3f37738030f4c5 diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/notify/NotificationPublishService.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/notify/NotificationPublishService.java index f5f03a106b..4c5ae16b0d 100644 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/notify/NotificationPublishService.java +++ b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/notify/NotificationPublishService.java @@ -9,9 +9,67 @@ package org.opendaylight.controller.md.sal.common.api.notify; import java.util.concurrent.ExecutorService; +/** + * Interface for publishing YANG-modeled notifications. + * + *

+ * Users of this interface can publish any YANG-modeled notification which will + * be delivered to all subscribed listeners. + * + *

+ * Preferred way of publishing of notifications is done by invoking {@link #publish(Object)}. + * + *

You may consider using {@link #publish(Object, ExecutorService)} if and only if + * your use-case requires customized execution policy or run-to-completion + * inside process. + * + *

+ * The metadata required to deliver a notification to the correct listeners is + * extracted from the published notification. + * + *

+ * FIXME: Consider clarification of execution/delivery policy, how it will be + * affected by Actor model and cluster-wide notifications. + * + * @param the type of notifications + */ +@Deprecated public interface NotificationPublishService { + /** + * Publishes a notification and notifies subscribed listeners. All listener + * notifications are done via a default executor. + * + *

+ * Note: This call will block when the default executor is saturated + * and the notification queue for this executor is full. + * + * @param notification + * the notification to publish. + */ void publish(N notification); - void publish(N notification,ExecutorService executor); + /** + * Publishes a notification and notifies subscribed listeners. All listener + * notifications are done via the provided executor. + * + *

+ * Note: Use only if necessary. Consider using + * {@link #publish(Object)} for most use-cases. + * + *

+ * By using this method you could customize execution policy of listeners present + * inside process (e.g. using single-threaded executor or even same-thread executor + * delivery. + * + *

+ * This executor is used only for inside-process notification deliveries. + * + * @param notification + * the notification to publish. + * @param executor + * the executor that will be used to deliver notifications to + * subscribed listeners. + */ + void publish(N notification, ExecutorService executor); }