Capture ListenersBroker instances
[netconf.git] / restconf / restconf-nb / src / main / java / org / opendaylight / restconf / nb / rfc8040 / rests / services / impl / CreateStreamUtil.java
index 4715e07c5c573c21d58e5b303e02032300a6d7de..8e5502928b97bb28c576edbb620ae38d7bf8c42e 100644 (file)
@@ -108,7 +108,7 @@ final class CreateStreamUtil {
      *     </pre>
      */
     // FIXME: this really should be a normal RPC implementation
-    static DOMRpcResult createDataChangeNotifiStream(final ContainerNode input,
+    static DOMRpcResult createDataChangeNotifiStream(final ListenersBroker listenersBroker, final ContainerNode input,
             final EffectiveModelContext refSchemaCtx) {
         // parsing out of container with settings and path
         final YangInstanceIdentifier path = preparePath(input);
@@ -123,7 +123,7 @@ final class CreateStreamUtil {
         final String streamName = streamNameBuilder.toString();
 
         // registration of the listener
-        ListenersBroker.getInstance().registerDataChangeListener(path, streamName, outputType);
+        listenersBroker.registerDataChangeListener(path, streamName, outputType);
 
         // building of output
         return new DefaultDOMRpcResult(Builders.containerBuilder()
@@ -182,7 +182,7 @@ final class CreateStreamUtil {
                 ErrorTag.OPERATION_FAILED);
         }
 
-        final DeviceNotificationListenerAdaptor notificationListenerAdapter = ListenersBroker.getInstance()
+        final DeviceNotificationListenerAdaptor notificationListenerAdapter = streamUtil.listenersBroker()
             .registerDeviceNotificationListener(deviceName, prepareOutputType(input), mountModelContext,
                 mountPointService, mountPoint.getIdentifier());
         notificationListenerAdapter.listen(mountNotifService, notificationPaths);