Fix futures handling in the NetconfRestconfTransaction 27/95327/2
authorOleksii Mozghovyi <oleksii.mozghovyi@pantheon.tech>
Tue, 23 Feb 2021 16:06:05 +0000 (18:06 +0200)
committerOleksii Mozghovyi <oleksii.mozghovyi@pantheon.tech>
Tue, 23 Feb 2021 16:24:20 +0000 (18:24 +0200)
This change solves the problem when the NetconfDataTreeService.lock()
returns an immutable list of futures, and the NetconfRestconfTransaction
wrapper can't change items on the list.

JIRA: NETCONF-705
Change-Id: Ie98f23382660683e269d3c1cdad6419be72545e5
Signed-off-by: Oleksii Mozghovyi <oleksii.mozghovyi@pantheon.tech>
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/transactions/NetconfRestconfTransaction.java

index 840a10d0b0c4896d50234ed5d370a5ef0cec4aac..55e9c93d3e611d0a7e99645540c99187b174fd07 100644 (file)
@@ -11,6 +11,7 @@ import static java.util.Objects.requireNonNull;
 
 import com.google.common.util.concurrent.FluentFuture;
 import com.google.common.util.concurrent.ListenableFuture;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
 import org.eclipse.jdt.annotation.NonNull;
@@ -33,7 +34,7 @@ final class NetconfRestconfTransaction extends RestconfTransaction {
 
     NetconfRestconfTransaction(final NetconfDataTreeService netconfService) {
         this.netconfService = requireNonNull(netconfService);
-        this.resultsFutures = netconfService.lock();
+        this.resultsFutures = new ArrayList<>(netconfService.lock());
     }
 
     @Override