X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-restconf-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frestconf%2Fbroker%2Fimpl%2FNotificationServiceImpl.java;fp=opendaylight%2Fmd-sal%2Fsal-restconf-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frestconf%2Fbroker%2Fimpl%2FNotificationServiceImpl.java;h=3272ce56707eff0159efbab3d3106f281e188f1a;hp=a0162395f57c6a88f529ab407d2ebe8578e194e3;hb=2360c06ec47235dff72d480292cc50abebcea418;hpb=04d9063615080acf6c7ac49221361cea6f502a5e diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/NotificationServiceImpl.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/NotificationServiceImpl.java index a0162395f5..3272ce5670 100644 --- a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/NotificationServiceImpl.java +++ b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/NotificationServiceImpl.java @@ -7,14 +7,11 @@ */ package org.opendaylight.controller.sal.restconf.broker.impl; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; -import com.google.common.collect.Multimaps; -import com.google.common.collect.SetMultimap; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.concurrent.ExecutorService; + import org.opendaylight.controller.sal.binding.api.NotificationListener; import org.opendaylight.controller.sal.binding.api.NotificationService; import org.opendaylight.controller.sal.restconf.broker.listeners.RemoteNotificationListener; @@ -27,9 +24,14 @@ import org.opendaylight.yangtools.restconf.client.api.RestconfClientContext; import org.opendaylight.yangtools.restconf.client.api.event.EventStreamInfo; import org.opendaylight.yangtools.yang.binding.Notification; +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; +import com.google.common.collect.Multimaps; +import com.google.common.collect.SetMultimap; + public class NotificationServiceImpl implements NotificationService { - private SalRemoteService salRemoteService; - private RestconfClientContext restconfClientContext; + private final SalRemoteService salRemoteService; + private final RestconfClientContext restconfClientContext; private final Multimap,NotificationListener> listeners; private ExecutorService _executor; @@ -82,9 +84,8 @@ public class NotificationServiceImpl implements NotificationService { String notificationStreamName = RemoteStreamTools.createNotificationStream(salRemoteService, notifications); final Map desiredEventStream = RemoteStreamTools.createEventStream(restconfClientContext, notificationStreamName); RemoteNotificationListener remoteNotificationListener = new RemoteNotificationListener(listener); - ListenerRegistration listenerRegistration = restconfClientContext.getEventStreamContext(desiredEventStream.get(desiredEventStream.get(notificationStreamName))).registerNotificationListener(remoteNotificationListener); - SalNotificationRegistration salNotificationRegistration = new SalNotificationRegistration(listenerRegistration); - return salNotificationRegistration; + ListenerRegistration listenerRegistration = restconfClientContext.getEventStreamContext(desiredEventStream.get(desiredEventStream.get(notificationStreamName))).registerNotificationListener(remoteNotificationListener); + return new SalNotificationRegistration(listenerRegistration); } @Override @@ -92,14 +93,13 @@ public class NotificationServiceImpl implements NotificationService { //TODO implementation using sal-remote String notificationStreamName = RemoteStreamTools.createNotificationStream(salRemoteService, null); final Map desiredEventStream = RemoteStreamTools.createEventStream(restconfClientContext, notificationStreamName); - ListenerRegistration listenerRegistration = restconfClientContext.getEventStreamContext(desiredEventStream.get(desiredEventStream.get(notificationStreamName))).registerNotificationListener(listener); - return listenerRegistration; + return restconfClientContext.getEventStreamContext(desiredEventStream.get(desiredEventStream.get(notificationStreamName))).registerNotificationListener(listener); } private class SalNotificationRegistration implements Registration>{ - private Registration registration; + private final Registration registration; - public SalNotificationRegistration(ListenerRegistration listenerRegistration){ + public SalNotificationRegistration(ListenerRegistration listenerRegistration){ this.registration = listenerRegistration; }