Do not reference streams in RestconfApplication 55/108755/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 30 Oct 2023 17:59:03 +0000 (18:59 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 30 Oct 2023 18:00:29 +0000 (19:00 +0100)
The only reason we needed these references is because we were creating
stream subscriptions. That is no longer necessary, hence ditch this
leak.

JIRA: NETCONF-1099
Change-Id: I5a6c1354dd1b4edbddbc8b852ebfd3b8fb6010ad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/RestconfApplication.java
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfDataServiceImpl.java
restconf/restconf-nb/src/test/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/Netconf799Test.java
restconf/restconf-nb/src/test/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfDataServiceImplTest.java

index 70b22e3a2203cafb4603edb5e7d6a486b93b890e..2e79f502be109f072217d58f310ba37a55524f22 100644 (file)
@@ -38,8 +38,7 @@ public class RestconfApplication extends AbstractRestconfApplication {
             final StreamsConfiguration configuration) {
         super(databindProvider, List.of(
             streamSubscription,
-            new RestconfDataServiceImpl(databindProvider, server, dataBroker, streamSubscription, actionService,
-                listenersBroker, configuration),
+            new RestconfDataServiceImpl(databindProvider, server, dataBroker, streamSubscription, actionService),
             new RestconfInvokeOperationsServiceImpl(databindProvider, server, mountPointService, listenersBroker,
                 configuration),
             new RestconfOperationsServiceImpl(databindProvider, server),
index 945a76414179d82b83e51ea8daaacfac3a227008..1cd54b0dbd17d7f13e55898cbb8c53b1651e5422 100644 (file)
@@ -79,8 +79,6 @@ import org.opendaylight.restconf.nb.rfc8040.legacy.InstanceIdentifierContext;
 import org.opendaylight.restconf.nb.rfc8040.legacy.NormalizedNodePayload;
 import org.opendaylight.restconf.nb.rfc8040.rests.services.api.RestconfStreamsSubscriptionService;
 import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfStrategy.CreateOrReplaceResult;
-import org.opendaylight.restconf.nb.rfc8040.streams.StreamsConfiguration;
-import org.opendaylight.restconf.nb.rfc8040.streams.listeners.ListenersBroker;
 import org.opendaylight.restconf.nb.rfc8040.utils.parser.IdentifierCodec;
 import org.opendaylight.yangtools.yang.common.Empty;
 import org.opendaylight.yangtools.yang.common.ErrorTag;
@@ -112,25 +110,19 @@ public final class RestconfDataServiceImpl {
 
     private final RestconfStreamsSubscriptionService delegRestconfSubscrService;
     private final DatabindProvider databindProvider;
-    private final SubscribeToStreamUtil streamUtils;
     private final DOMActionService actionService;
     private final MdsalRestconfServer server;
     @Deprecated(forRemoval = true)
     private final DOMDataBroker dataBroker;
-    private final ListenersBroker listenersBroker;
 
     public RestconfDataServiceImpl(final DatabindProvider databindProvider, final MdsalRestconfServer server,
             final DOMDataBroker dataBroker, final RestconfStreamsSubscriptionService delegRestconfSubscrService,
-            final DOMActionService actionService, final ListenersBroker listenersBroker,
-            final StreamsConfiguration configuration) {
+            final DOMActionService actionService) {
         this.databindProvider = requireNonNull(databindProvider);
         this.server = requireNonNull(server);
         this.dataBroker = requireNonNull(dataBroker);
         this.delegRestconfSubscrService = requireNonNull(delegRestconfSubscrService);
         this.actionService = requireNonNull(actionService);
-        this.listenersBroker = requireNonNull(listenersBroker);
-        streamUtils = configuration.useSSE() ? SubscribeToStreamUtil.serverSentEvents(listenersBroker)
-                : SubscribeToStreamUtil.webSockets(listenersBroker);
     }
 
     /**
index ff334685cb6585ec7e6b1e9d2e37eab9ce9b50ee..2eecae0103e4d17a2d00cdd9a412a6769e76ee9b 100644 (file)
@@ -30,8 +30,6 @@ import org.opendaylight.mdsal.dom.spi.SimpleDOMActionResult;
 import org.opendaylight.restconf.nb.rfc8040.AbstractInstanceIdentifierTest;
 import org.opendaylight.restconf.nb.rfc8040.databind.DatabindContext;
 import org.opendaylight.restconf.nb.rfc8040.rests.services.api.RestconfStreamsSubscriptionService;
-import org.opendaylight.restconf.nb.rfc8040.streams.StreamsConfiguration;
-import org.opendaylight.restconf.nb.rfc8040.streams.listeners.ListenersBroker;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
@@ -64,7 +62,7 @@ public class Netconf799Test extends AbstractInstanceIdentifierTest {
 
         final var dataService = new RestconfDataServiceImpl(() -> DatabindContext.ofModel(IID_SCHEMA),
             new MdsalRestconfServer(dataBroker, rpcService, mountPointService), dataBroker, restconfStreamSubService,
-            actionService, new ListenersBroker(), new StreamsConfiguration(0, 1, 0, false));
+            actionService);
 
         doReturn(true).when(asyncResponse).resume(captor.capture());
         dataService.postDataJSON("instance-identifier-module:cont/cont1/reset",
index 90cb56692710d3b263f645db5da24d64b21e4e6d..16918e06e5d6aff236cd2f56b50d6af71b22fd10 100644 (file)
@@ -63,8 +63,6 @@ import org.opendaylight.restconf.nb.rfc8040.AbstractJukeboxTest;
 import org.opendaylight.restconf.nb.rfc8040.databind.DatabindContext;
 import org.opendaylight.restconf.nb.rfc8040.legacy.NormalizedNodePayload;
 import org.opendaylight.restconf.nb.rfc8040.rests.services.api.RestconfStreamsSubscriptionService;
-import org.opendaylight.restconf.nb.rfc8040.streams.StreamsConfiguration;
-import org.opendaylight.restconf.nb.rfc8040.streams.listeners.ListenersBroker;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.patch.rev170222.yang.patch.yang.patch.Edit.Operation;
 import org.opendaylight.yangtools.yang.common.ErrorTag;
 import org.opendaylight.yangtools.yang.common.ErrorType;
@@ -136,7 +134,7 @@ public class RestconfDataServiceImplTest extends AbstractJukeboxTest {
 
         dataService = new RestconfDataServiceImpl(() -> DatabindContext.ofModel(JUKEBOX_SCHEMA),
             new MdsalRestconfServer(dataBroker, rpcService, mountPointService), dataBroker, delegRestconfSubscrService,
-            actionService, new ListenersBroker(), new StreamsConfiguration(0, 1, 0, false));
+            actionService);
         doReturn(Optional.of(mountPoint)).when(mountPointService)
                 .getMountPoint(any(YangInstanceIdentifier.class));
         doReturn(Optional.of(FixedDOMSchemaService.of(JUKEBOX_SCHEMA))).when(mountPoint)