From 354472dc8d3afa557522c8ea18634b11b4bea20b Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Mon, 1 Oct 2018 18:45:43 +0200 Subject: [PATCH] Do not retain the list of RPCs These RPCs are only used when a listener registers, there is simply no point to retain them in a transformed collection. We can always re-create them as needed from the SchemaContext. Change-Id: Ia47c3163bff5232d079f8768420bfa6360fe3b49 Signed-off-by: Robert Varga --- .../sal/connect/netconf/sal/NetconfDeviceRpc.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceRpc.java b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceRpc.java index 897cdaa5c7..01cdac9d6b 100644 --- a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceRpc.java +++ b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceRpc.java @@ -7,12 +7,13 @@ */ package org.opendaylight.netconf.sal.connect.netconf.sal; +import static java.util.Objects.requireNonNull; + import com.google.common.collect.Collections2; import com.google.common.util.concurrent.CheckedFuture; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.MoreExecutors; -import java.util.Collection; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opendaylight.controller.md.sal.dom.api.DOMRpcAvailabilityListener; @@ -38,16 +39,14 @@ public final class NetconfDeviceRpc implements DOMRpcService { private final RemoteDeviceCommunicator communicator; private final MessageTransformer transformer; - private final Collection availableRpcs; + private final SchemaContext schemaContext; public NetconfDeviceRpc(final SchemaContext schemaContext, final RemoteDeviceCommunicator communicator, final MessageTransformer transformer) { this.communicator = communicator; this.transformer = transformer; - - availableRpcs = Collections2.transform(schemaContext.getOperations(), - input -> DOMRpcIdentifier.create(input.getPath())); + this.schemaContext = requireNonNull(schemaContext); } @Nonnull @@ -76,7 +75,8 @@ public final class NetconfDeviceRpc implements DOMRpcService { public ListenerRegistration registerRpcListener( @Nonnull final T listener) { - listener.onRpcAvailable(availableRpcs); + listener.onRpcAvailable(Collections2.transform(schemaContext.getOperations(), + input -> DOMRpcIdentifier.create(input.getPath()))); return new ListenerRegistration() { @Override -- 2.36.6